diff options
Diffstat (limited to 'unittests/Support/YAMLIOTest.cpp')
| -rw-r--r-- | unittests/Support/YAMLIOTest.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/unittests/Support/YAMLIOTest.cpp b/unittests/Support/YAMLIOTest.cpp index 5cf0e9d0f5b35..120773a0c8dd8 100644 --- a/unittests/Support/YAMLIOTest.cpp +++ b/unittests/Support/YAMLIOTest.cpp @@ -232,6 +232,22 @@ TEST(YAMLIO, TestSequenceMapWriteAndRead) { } } +// +// Test YAML filename handling. +// +static void testErrorFilename(const llvm::SMDiagnostic &Error, void *) { + EXPECT_EQ(Error.getFilename(), "foo.yaml"); +} + +TEST(YAMLIO, TestGivenFilename) { + auto Buffer = llvm::MemoryBuffer::getMemBuffer("{ x: 42 }", "foo.yaml"); + Input yin(*Buffer, nullptr, testErrorFilename); + FooBar Value; + yin >> Value; + + EXPECT_TRUE(!!yin.error()); +} + //===----------------------------------------------------------------------===// // Test built-in types |
