@@ -2271,6 +2271,40 @@ TEST_F(VFSFromYAMLTest, YAMLVFSWriterTest2) {
2271
2271
EXPECT_FALSE (FS.get () != nullptr );
2272
2272
}
2273
2273
2274
+ TEST_F (VFSFromYAMLTest, YAMLVFSWriterTest3) {
2275
+ ScopedDir TestDirectory (" virtual-file-system-test" , /* Unique*/ true );
2276
+ ScopedDir _a (TestDirectory + " /a" );
2277
+ ScopedFile _ab (TestDirectory + " /a/b" , " " );
2278
+ ScopedDir _ac (TestDirectory + " /a/c" );
2279
+ ScopedDir _acd (TestDirectory + " /a/c/d" );
2280
+ ScopedDir _acde (TestDirectory + " /a/c/d/e" );
2281
+ ScopedFile _acdef (TestDirectory + " /a/c/d/e/f" , " " );
2282
+ ScopedFile _acdeg (TestDirectory + " /a/c/d/e/g" , " " );
2283
+ ScopedDir _ah (TestDirectory + " /a/h" );
2284
+ ScopedFile _ahi (TestDirectory + " /a/h/i" , " " );
2285
+
2286
+ vfs::YAMLVFSWriter VFSWriter;
2287
+ VFSWriter.addDirectoryMapping (_a.Path , " //root/a" );
2288
+ VFSWriter.addFileMapping (_ab.Path , " //root/a/b" );
2289
+ VFSWriter.addDirectoryMapping (_ac.Path , " //root/a/c" );
2290
+ VFSWriter.addDirectoryMapping (_acd.Path , " //root/a/c/d" );
2291
+ VFSWriter.addDirectoryMapping (_acde.Path , " //root/a/c/d/e" );
2292
+ VFSWriter.addFileMapping (_acdef.Path , " //root/a/c/d/e/f" );
2293
+ VFSWriter.addFileMapping (_acdeg.Path , " //root/a/c/d/e/g" );
2294
+ VFSWriter.addDirectoryMapping (_ahi.Path , " //root/a/h" );
2295
+ VFSWriter.addFileMapping (_ahi.Path , " //root/a/h/i" );
2296
+
2297
+ std::string Buffer;
2298
+ raw_string_ostream OS (Buffer);
2299
+ VFSWriter.write (OS);
2300
+ OS.flush ();
2301
+
2302
+ IntrusiveRefCntPtr<ErrorDummyFileSystem> Lower (new ErrorDummyFileSystem ());
2303
+ IntrusiveRefCntPtr<vfs::FileSystem> FS = getFromYAMLRawString (Buffer, Lower);
2304
+ // FIXME: Spurious comma separator before first file entry in directory.
2305
+ EXPECT_FALSE (FS.get () != nullptr );
2306
+ }
2307
+
2274
2308
TEST_F (VFSFromYAMLTest, YAMLVFSWriterTestHandleDirs) {
2275
2309
ScopedDir TestDirectory (" virtual-file-system-test" , /* Unique*/ true );
2276
2310
ScopedDir _a (TestDirectory + " /a" );
0 commit comments