[PATCH] Add a VFSFromYAML class and a parser to create it
Dmitri Gribenko
gribozavr at gmail.com
Fri Feb 21 14:37:36 PST 2014
LGTM.
================
Comment at: unittests/Basic/VirtualFileSystemTest.cpp:253-254
@@ +252,4 @@
+
+TEST(VirtualFileSystemTest, MappedFiles) {
+ NumDiagnostics = 0;
+ IntrusiveRefCntPtr<DummyFileSystem> Lower(new DummyFileSystem());
----------------
You could use TEST_F to create a test fixture. Then you don't need a variable with a static lifetime, since you can hang it on the instance of the fixture.
================
Comment at: unittests/Basic/VirtualFileSystemTest.cpp:380
@@ +379,3 @@
+ IntrusiveRefCntPtr<vfs::FileSystem> FS = getFromYAMLString("{]", Lower);
+ EXPECT_FALSE(FS.getPtr());
+ // invalid YAML in roots
----------------
Here and other EXPECT_FALSE(pointer) lines:
EXPECT_EQ(NULL, FS.getPtr());
================
Comment at: unittests/Basic/VirtualFileSystemTest.cpp:390-393
@@ +389,6 @@
+ // invalid configuration
+ FS = getFromYAMLString("{ 'knobular': 'true', 'roots':[] }", Lower);
+ EXPECT_FALSE(FS.getPtr());
+ FS = getFromYAMLString("{ 'case-sensitive': 'maybe', 'roots':[] }", Lower);
+ EXPECT_FALSE(FS.getPtr());
+
----------------
If you like, you can reduce the duplication by defining a function that returns ::testing::AssertionResult and using it directly inside EXPECT_TRUE/EXPECT_FALSE.
http://llvm-reviews.chandlerc.com/D2835
BRANCH
vfs/patch3-yaml
ARCANIST PROJECT
clang
More information about the cfe-commits
mailing list