File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1273,6 +1273,36 @@ TEST(YAMLIO, TestReadWriteBlockScalarValue) {
1273
1273
}
1274
1274
}
1275
1275
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\n BB" ;
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
+
1276
1306
// ===----------------------------------------------------------------------===//
1277
1307
// Test flow sequences
1278
1308
// ===----------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments