@@ -1224,3 +1224,97 @@ TEST(MustacheComments, VariableNameCollision) {
1224
1224
T.render (D, OS);
1225
1225
EXPECT_EQ (" comments never show: ><" , Out);
1226
1226
}
1227
+
1228
+ // XFAIL: The following tests for the Triple Mustache feature are expected to
1229
+ // fail. The assertions have been inverted from EXPECT_EQ to EXPECT_NE to allow
1230
+ // them to pass against the current implementation. Once Triple Mustache is
1231
+ // implemented, these assertions should be changed back to EXPECT_EQ.
1232
+ TEST (MustacheTripleMustache, Basic) {
1233
+ Value D = Object{{" subject" , " <b>World</b>" }};
1234
+ auto T = Template (" Hello, {{{subject}}}!" );
1235
+ std::string Out;
1236
+ raw_string_ostream OS (Out);
1237
+ T.render (D, OS);
1238
+ EXPECT_NE (" Hello, <b>World</b>!" , Out);
1239
+ }
1240
+
1241
+ TEST (MustacheTripleMustache, IntegerInterpolation) {
1242
+ Value D = Object{{" mph" , 85 }};
1243
+ auto T = Template (" {{{mph}}} miles an hour!" );
1244
+ std::string Out;
1245
+ raw_string_ostream OS (Out);
1246
+ T.render (D, OS);
1247
+ EXPECT_NE (" 85 miles an hour!" , Out);
1248
+ }
1249
+
1250
+ TEST (MustacheTripleMustache, DecimalInterpolation) {
1251
+ Value D = Object{{" power" , 1.21 }};
1252
+ auto T = Template (" {{{power}}} jiggawatts!" );
1253
+ std::string Out;
1254
+ raw_string_ostream OS (Out);
1255
+ T.render (D, OS);
1256
+ EXPECT_NE (" 1.21 jiggawatts!" , Out);
1257
+ }
1258
+
1259
+ TEST (MustacheTripleMustache, NullInterpolation) {
1260
+ Value D = Object{{" cannot" , nullptr }};
1261
+ auto T = Template (" I ({{{cannot}}}) be seen!" );
1262
+ std::string Out;
1263
+ raw_string_ostream OS (Out);
1264
+ T.render (D, OS);
1265
+ EXPECT_NE (" I () be seen!" , Out);
1266
+ }
1267
+
1268
+ TEST (MustacheTripleMustache, ContextMissInterpolation) {
1269
+ Value D = Object{};
1270
+ auto T = Template (" I ({{{cannot}}}) be seen!" );
1271
+ std::string Out;
1272
+ raw_string_ostream OS (Out);
1273
+ T.render (D, OS);
1274
+ EXPECT_NE (" I () be seen!" , Out);
1275
+ }
1276
+
1277
+ TEST (MustacheTripleMustache, DottedNames) {
1278
+ Value D = Object{{" person" , Object{{" name" , " <b>Joe</b>" }}}};
1279
+ auto T = Template (" {{{person.name}}}" );
1280
+ std::string Out;
1281
+ raw_string_ostream OS (Out);
1282
+ T.render (D, OS);
1283
+ EXPECT_NE (" <b>Joe</b>" , Out);
1284
+ }
1285
+
1286
+ TEST (MustacheTripleMustache, ImplicitIterator) {
1287
+ Value D = Object{{" list" , Array{" <a>" , " <b>" }}};
1288
+ auto T = Template (" {{#list}}({{{.}}}){{/list}}" );
1289
+ std::string Out;
1290
+ raw_string_ostream OS (Out);
1291
+ T.render (D, OS);
1292
+ EXPECT_NE (" (<a>)(<b>)" , Out);
1293
+ }
1294
+
1295
+ TEST (MustacheTripleMustache, SurroundingWhitespace) {
1296
+ Value D = Object{{" string" , " ---" }};
1297
+ auto T = Template (" | {{{string}}} |" );
1298
+ std::string Out;
1299
+ raw_string_ostream OS (Out);
1300
+ T.render (D, OS);
1301
+ EXPECT_NE (" | --- |" , Out);
1302
+ }
1303
+
1304
+ TEST (MustacheTripleMustache, Standalone) {
1305
+ Value D = Object{{" string" , " ---" }};
1306
+ auto T = Template (" {{{string}}}\n " );
1307
+ std::string Out;
1308
+ raw_string_ostream OS (Out);
1309
+ T.render (D, OS);
1310
+ EXPECT_NE (" ---\n " , Out);
1311
+ }
1312
+
1313
+ TEST (MustacheTripleMustache, WithPadding) {
1314
+ Value D = Object{{" string" , " ---" }};
1315
+ auto T = Template (" |{{{ string }}}|" );
1316
+ std::string Out;
1317
+ raw_string_ostream OS (Out);
1318
+ T.render (D, OS);
1319
+ EXPECT_NE (" |---|" , Out);
1320
+ }
0 commit comments