Browse Source

Namespaces test fixed

pull/399/head
Pyry Kontio 11 years ago
parent
commit
87d028f2aa
  1. 16
      build/Tests.lua
  2. 2
      tests/NamespacesBase/NamespacesBase.cpp
  3. 0
      tests/NamespacesBase/NamespacesBase.h
  4. 2
      tests/NamespacesDerived/NamespacesDerived.cpp
  5. 5
      tests/NamespacesDerived/NamespacesDerived.cs
  6. 2
      tests/NamespacesDerived/NamespacesDerived.h
  7. 2
      tests/NamespacesDerived/premake4.lua

16
build/Tests.lua

@ -15,8 +15,8 @@ end
function SetupTestProject(name, file, lib) function SetupTestProject(name, file, lib)
SetupTestGeneratorProject(name) SetupTestGeneratorProject(name)
SetupTestNativeProject(name) SetupTestNativeProject(name)
SetupTestProjectsCSharp(name, file, lib) SetupTestProjectsCSharp(name)
SetupTestProjectsCLI(name, file, lib) SetupTestProjectsCLI(name)
end end
function SetupTestCSharp(name) function SetupTestCSharp(name)
@ -102,7 +102,7 @@ function LinkNUnit()
} }
end end
function SetupTestProjectsCSharp(name, file, lib) function SetupTestProjectsCSharp(name, depends)
project(name .. ".CSharp") project(name .. ".CSharp")
SetupManagedTestProject() SetupManagedTestProject()
@ -114,7 +114,13 @@ function SetupTestProjectsCSharp(name, file, lib)
path.join(gendir, name, name .. ".cs"), path.join(gendir, name, name .. ".cs"),
} }
links { "CppSharp.Runtime" } linktable = { "CppSharp.Runtime" }
if depends ~= nil then
table.insert(linktable, depends)
end
links(linktable)
project(name .. ".Tests.CSharp") project(name .. ".Tests.CSharp")
SetupManagedTestProject() SetupManagedTestProject()
@ -127,7 +133,7 @@ function SetupTestProjectsCSharp(name, file, lib)
links { "CppSharp.Runtime" } links { "CppSharp.Runtime" }
end end
function SetupTestProjectsCLI(name, file, lib) function SetupTestProjectsCLI(name)
if not os.is_windows() then if not os.is_windows() then
return return
end end

2
tests/NamespacesBase/Base.cpp → tests/NamespacesBase/NamespacesBase.cpp

@ -1,4 +1,4 @@
#include "Base.h" #include "NamespacesBase.h"
Base::Base(int i) Base::Base(int i)

0
tests/NamespacesBase/Base.h → tests/NamespacesBase/NamespacesBase.h

2
tests/NamespacesDerived/Derived.cpp → tests/NamespacesDerived/NamespacesDerived.cpp

@ -1,4 +1,4 @@
#include "Derived.h" #include "NamespacesDerived.h"
Derived::Derived() : Base(10), component(5) Derived::Derived() : Base(10), component(5)

5
tests/NamespacesDerived/NamespacesDerived.cs

@ -1,4 +1,4 @@
?using System; using System;
using CppSharp.AST; using CppSharp.AST;
using CppSharp.Generators; using CppSharp.Generators;
using CppSharp.Utils; using CppSharp.Utils;
@ -15,13 +15,14 @@ namespace CppSharp.Tests
public override void SetupPasses(Driver driver) public override void SetupPasses(Driver driver)
{ {
driver.Options.DependentNameSpaces.Add("NamespacesBase");
} }
public override void Preprocess(Driver driver, ASTContext ctx) public override void Preprocess(Driver driver, ASTContext ctx)
{ {
foreach (TranslationUnit unit in ctx.TranslationUnits) foreach (TranslationUnit unit in ctx.TranslationUnits)
{ {
if (unit.FileName != "Derived.h") if (unit.FileName != "NamespacesDerived.h")
{ {
unit.GenerationKind = GenerationKind.Link; unit.GenerationKind = GenerationKind.Link;
} }

2
tests/NamespacesDerived/Derived.h → tests/NamespacesDerived/NamespacesDerived.h

@ -1,5 +1,5 @@
#include "../Tests.h" #include "../Tests.h"
#include "../NamespacesBase/Base.h" #include "../NamespacesBase/NamespacesBase.h"
class DLL_API Derived : public Base class DLL_API Derived : public Base
{ {

2
tests/NamespacesDerived/premake4.lua

@ -1,4 +1,4 @@
group "Tests/Namespaces" group "Tests/Namespaces"
SetupTestGeneratorProject("NamespacesDerived") SetupTestGeneratorProject("NamespacesDerived")
SetupTestNativeProject("NamespacesDerived", "NamespacesBase.Native") SetupTestNativeProject("NamespacesDerived", "NamespacesBase.Native")
SetupTestProjectsCSharp("NamespacesDerived") SetupTestProjectsCSharp("NamespacesDerived", "NamespacesBase.CSharp")
Loading…
Cancel
Save