Browse Source

Remove needless generation of using-s in tests

Fixes https://github.com/mono/CppSharp/issues/1490.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1574/head
Dimitar Dobrev 5 years ago
parent
commit
ba2310830a
  1. 18
      tests/NamespacesDerived/NamespacesDerived.Gen.cs

18
tests/NamespacesDerived/NamespacesDerived.Gen.cs

@ -1,5 +1,4 @@
using System.IO; using System.IO;
using CppSharp.AST;
using CppSharp.Generators; using CppSharp.Generators;
using CppSharp.Utils; using CppSharp.Utils;
@ -18,9 +17,8 @@ namespace CppSharp.Tests
driver.Options.GenerateDefaultValuesForArguments = true; driver.Options.GenerateDefaultValuesForArguments = true;
driver.Options.GenerateClassTemplates = true; driver.Options.GenerateClassTemplates = true;
driver.Options.CompileCode = true; driver.Options.CompileCode = true;
driver.Options.DependentNameSpaces.Add("System.Runtime.CompilerServices");
driver.Options.Modules[1].IncludeDirs.Add(GetTestsDirectory("NamespacesDerived")); driver.Options.Modules[1].IncludeDirs.Add(GetTestsDirectory("NamespacesDerived"));
var @base = "NamespacesBase"; const string @base = "NamespacesBase";
var module = driver.Options.AddModule(@base); var module = driver.Options.AddModule(@base);
module.IncludeDirs.Add(Path.GetFullPath(GetTestsDirectory(@base))); module.IncludeDirs.Add(Path.GetFullPath(GetTestsDirectory(@base)));
module.Headers.Add($"{@base}.h"); module.Headers.Add($"{@base}.h");
@ -29,21 +27,11 @@ namespace CppSharp.Tests
module.Libraries.Add($"{@base}.Native"); module.Libraries.Add($"{@base}.Native");
driver.Options.Modules[1].Dependencies.Add(module); driver.Options.Modules[1].Dependencies.Add(module);
} }
public override void Postprocess(Driver driver, ASTContext ctx)
{
driver.Generator.OnUnitGenerated += o =>
{
Block firstBlock = o.Outputs[0].RootBlock.Blocks[1];
firstBlock.NewLine();
firstBlock.WriteLine("[assembly:InternalsVisibleTo(\"NamespacesDerived.CSharp\")]");
};
}
} }
public class NamespacesDerived public static class NamespacesDerived
{ {
public static void Main(string[] args) public static void Main()
{ {
ConsoleDriver.Run(new NamespacesDerivedTests(GeneratorKind.CSharp)); ConsoleDriver.Run(new NamespacesDerivedTests(GeneratorKind.CSharp));
} }

Loading…
Cancel
Save