forked from xoofx/CppAst.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from CognexVisionSoftware/feature/fix_using
'using' is not recognized
- Loading branch information
Showing
2 changed files
with
87 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using NUnit.Framework; | ||
|
||
namespace CppAst.Tests | ||
{ | ||
public class TestMisc : InlineTestBase | ||
{ | ||
[Test] | ||
public void TestMiscFeatures() | ||
{ | ||
ParseAssert(@" | ||
class Foo | ||
{ | ||
public: | ||
Foo(int x) : x_{x} {} | ||
private: | ||
int x_{0}; | ||
}; | ||
class Bar : public Foo | ||
{ | ||
public: | ||
using Foo::Foo; | ||
}; | ||
", | ||
compilation => | ||
{ | ||
Assert.False(compilation.HasErrors); | ||
Assert.AreEqual(2, compilation.Classes.Count); | ||
Assert.AreEqual(1, compilation.Classes[0].Constructors.Count); | ||
// Bar will get 3 constructors | ||
Assert.AreEqual(3, compilation.Classes[1].Constructors.Count); | ||
Assert.AreEqual(CppVisibility.Public, compilation.Classes[1].Constructors[0].Visibility); | ||
Assert.AreEqual(CppVisibility.Public, compilation.Classes[1].Constructors[1].Visibility); | ||
Assert.AreEqual(CppVisibility.Public, compilation.Classes[1].Constructors[2].Visibility); | ||
} | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters