Skip to content

Commit cb4ae35

Browse files
authored
[YAML][NFC] precommit wrong test case (#131782)
1 parent bcedb36 commit cb4ae35

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

llvm/unittests/Support/YAMLIOTest.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,36 @@ TEST(YAMLIO, TestReadWriteBlockScalarValue) {
12731273
}
12741274
}
12751275

1276+
struct V {
1277+
MultilineStringType doc;
1278+
std::string str;
1279+
};
1280+
template <> struct MappingTraits<V> {
1281+
static void mapping(IO &io, V &v) {
1282+
io.mapRequired("block_scalac", v.doc);
1283+
io.mapRequired("scalar", v.str);
1284+
}
1285+
};
1286+
template <> struct llvm::yaml::SequenceElementTraits<V> {
1287+
static const bool flow = false;
1288+
};
1289+
TEST(YAMLIO, TestScalarAfterBlockScalar) {
1290+
std::vector<V> v{V{}};
1291+
v[0].doc.str = "AA\nBB";
1292+
v[0].str = "a";
1293+
std::string output;
1294+
llvm::raw_string_ostream ostr(output);
1295+
Output yout(ostr);
1296+
yout << v;
1297+
EXPECT_EQ(output, R"(---
1298+
- block_scalac: |
1299+
AA
1300+
BB
1301+
scalar: a
1302+
...
1303+
)");
1304+
}
1305+
12761306
//===----------------------------------------------------------------------===//
12771307
// Test flow sequences
12781308
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)