Lines Matching refs:templates

56 do_test_ok(const text::templates_def& templates, const std::string& input_str,  in do_test_ok()  argument
62 text::instantiate(templates, input, output); in do_test_ok()
76 do_test_fail(const text::templates_def& templates, const std::string& input_str, in do_test_fail() argument
83 text::instantiate(templates, input, output)); in do_test_fail()
93 text::templates_def templates; in ATF_TEST_CASE_BODY() local
94 templates.add_variable("the-name", "first-value"); in ATF_TEST_CASE_BODY()
95 ATF_REQUIRE_EQ("first-value", templates.get_variable("the-name")); in ATF_TEST_CASE_BODY()
102 text::templates_def templates; in ATF_TEST_CASE_BODY() local
103 templates.add_variable("the-name", "first-value"); in ATF_TEST_CASE_BODY()
104 templates.add_variable("the-name", "second-value"); in ATF_TEST_CASE_BODY()
105 ATF_REQUIRE_EQ("second-value", templates.get_variable("the-name")); in ATF_TEST_CASE_BODY()
112 text::templates_def templates; in ATF_TEST_CASE_BODY() local
113 templates.add_variable("the-name", "the-value"); in ATF_TEST_CASE_BODY()
114 templates.get_variable("the-name"); // Should not throw. in ATF_TEST_CASE_BODY()
115 templates.remove_variable("the-name"); in ATF_TEST_CASE_BODY()
116 ATF_REQUIRE_THROW(text::syntax_error, templates.get_variable("the-name")); in ATF_TEST_CASE_BODY()
123 text::templates_def templates; in ATF_TEST_CASE_BODY() local
124 templates.add_vector("the-name"); in ATF_TEST_CASE_BODY()
125 ATF_REQUIRE(templates.get_vector("the-name").empty()); in ATF_TEST_CASE_BODY()
132 text::templates_def templates; in ATF_TEST_CASE_BODY() local
133 templates.add_vector("the-name"); in ATF_TEST_CASE_BODY()
134 templates.add_to_vector("the-name", "foo"); in ATF_TEST_CASE_BODY()
135 ATF_REQUIRE(!templates.get_vector("the-name").empty()); in ATF_TEST_CASE_BODY()
136 templates.add_vector("the-name"); in ATF_TEST_CASE_BODY()
137 ATF_REQUIRE(templates.get_vector("the-name").empty()); in ATF_TEST_CASE_BODY()
144 text::templates_def templates; in ATF_TEST_CASE_BODY() local
145 templates.add_vector("the-name"); in ATF_TEST_CASE_BODY()
146 ATF_REQUIRE_EQ(0, templates.get_vector("the-name").size()); in ATF_TEST_CASE_BODY()
147 templates.add_to_vector("the-name", "first"); in ATF_TEST_CASE_BODY()
148 ATF_REQUIRE_EQ(1, templates.get_vector("the-name").size()); in ATF_TEST_CASE_BODY()
149 templates.add_to_vector("the-name", "second"); in ATF_TEST_CASE_BODY()
150 ATF_REQUIRE_EQ(2, templates.get_vector("the-name").size()); in ATF_TEST_CASE_BODY()
151 templates.add_to_vector("the-name", "third"); in ATF_TEST_CASE_BODY()
152 ATF_REQUIRE_EQ(3, templates.get_vector("the-name").size()); in ATF_TEST_CASE_BODY()
158 ATF_REQUIRE(expected == templates.get_vector("the-name")); in ATF_TEST_CASE_BODY()
165 text::templates_def templates; in ATF_TEST_CASE_BODY() local
166 ATF_REQUIRE(!templates.exists("some-name")); in ATF_TEST_CASE_BODY()
167 templates.add_variable("some-name ", "foo"); in ATF_TEST_CASE_BODY()
168 ATF_REQUIRE(!templates.exists("some-name")); in ATF_TEST_CASE_BODY()
169 templates.add_variable("some-name", "foo"); in ATF_TEST_CASE_BODY()
170 ATF_REQUIRE(templates.exists("some-name")); in ATF_TEST_CASE_BODY()
177 text::templates_def templates; in ATF_TEST_CASE_BODY() local
178 ATF_REQUIRE(!templates.exists("some-name")); in ATF_TEST_CASE_BODY()
179 templates.add_vector("some-name "); in ATF_TEST_CASE_BODY()
180 ATF_REQUIRE(!templates.exists("some-name")); in ATF_TEST_CASE_BODY()
181 templates.add_vector("some-name"); in ATF_TEST_CASE_BODY()
182 ATF_REQUIRE(templates.exists("some-name")); in ATF_TEST_CASE_BODY()
189 text::templates_def templates; in ATF_TEST_CASE_BODY() local
190 templates.add_variable("foo", ""); in ATF_TEST_CASE_BODY()
191 templates.add_variable("bar", " baz "); in ATF_TEST_CASE_BODY()
192 ATF_REQUIRE_EQ("", templates.get_variable("foo")); in ATF_TEST_CASE_BODY()
193 ATF_REQUIRE_EQ(" baz ", templates.get_variable("bar")); in ATF_TEST_CASE_BODY()
200 text::templates_def templates; in ATF_TEST_CASE_BODY() local
201 templates.add_variable("foo", ""); in ATF_TEST_CASE_BODY()
203 templates.get_variable("foo ")); in ATF_TEST_CASE_BODY()
210 text::templates_def templates; in ATF_TEST_CASE_BODY() local
211 templates.add_vector("foo"); in ATF_TEST_CASE_BODY()
212 templates.add_vector("bar"); in ATF_TEST_CASE_BODY()
213 templates.add_to_vector("bar", "baz"); in ATF_TEST_CASE_BODY()
214 ATF_REQUIRE_EQ(0, templates.get_vector("foo").size()); in ATF_TEST_CASE_BODY()
215 ATF_REQUIRE_EQ(1, templates.get_vector("bar").size()); in ATF_TEST_CASE_BODY()
222 text::templates_def templates; in ATF_TEST_CASE_BODY() local
223 templates.add_vector("foo"); in ATF_TEST_CASE_BODY()
225 templates.get_vector("foo ")); in ATF_TEST_CASE_BODY()
232 text::templates_def templates; in ATF_TEST_CASE_BODY() local
233 templates.add_variable("foo", ""); in ATF_TEST_CASE_BODY()
234 templates.add_variable("bar", " baz "); in ATF_TEST_CASE_BODY()
235 ATF_REQUIRE_EQ("", templates.evaluate("foo")); in ATF_TEST_CASE_BODY()
236 ATF_REQUIRE_EQ(" baz ", templates.evaluate("bar")); in ATF_TEST_CASE_BODY()
243 text::templates_def templates; in ATF_TEST_CASE_BODY() local
244 templates.add_variable("foo", ""); in ATF_TEST_CASE_BODY()
246 templates.evaluate("foo1")); in ATF_TEST_CASE_BODY()
253 text::templates_def templates; in ATF_TEST_CASE_BODY() local
254 templates.add_vector("v"); in ATF_TEST_CASE_BODY()
255 templates.add_to_vector("v", "foo"); in ATF_TEST_CASE_BODY()
256 templates.add_to_vector("v", "bar"); in ATF_TEST_CASE_BODY()
257 templates.add_to_vector("v", "baz"); in ATF_TEST_CASE_BODY()
259 templates.add_variable("index", "0"); in ATF_TEST_CASE_BODY()
260 ATF_REQUIRE_EQ("foo", templates.evaluate("v(index)")); in ATF_TEST_CASE_BODY()
261 templates.add_variable("index", "1"); in ATF_TEST_CASE_BODY()
262 ATF_REQUIRE_EQ("bar", templates.evaluate("v(index)")); in ATF_TEST_CASE_BODY()
263 templates.add_variable("index", "2"); in ATF_TEST_CASE_BODY()
264 ATF_REQUIRE_EQ("baz", templates.evaluate("v(index)")); in ATF_TEST_CASE_BODY()
271 text::templates_def templates; in ATF_TEST_CASE_BODY() local
272 templates.add_vector("v"); in ATF_TEST_CASE_BODY()
273 templates.add_to_vector("v", "foo"); in ATF_TEST_CASE_BODY()
274 templates.add_variable("index", "0"); in ATF_TEST_CASE_BODY()
276 templates.evaluate("fooz(index)")); in ATF_TEST_CASE_BODY()
283 text::templates_def templates; in ATF_TEST_CASE_BODY() local
284 templates.add_vector("v"); in ATF_TEST_CASE_BODY()
285 templates.add_to_vector("v", "foo"); in ATF_TEST_CASE_BODY()
286 templates.add_variable("index", "0"); in ATF_TEST_CASE_BODY()
288 templates.evaluate("v(indexz)")); in ATF_TEST_CASE_BODY()
295 text::templates_def templates; in ATF_TEST_CASE_BODY() local
296 templates.add_vector("v"); in ATF_TEST_CASE_BODY()
297 templates.add_to_vector("v", "foo"); in ATF_TEST_CASE_BODY()
298 templates.add_variable("index", "1"); in ATF_TEST_CASE_BODY()
300 "at position '1'", templates.evaluate("v(index)")); in ATF_TEST_CASE_BODY()
307 text::templates_def templates; in ATF_TEST_CASE_BODY() local
308 templates.add_vector("the-variable"); in ATF_TEST_CASE_BODY()
309 templates.add_vector("the-vector"); in ATF_TEST_CASE_BODY()
310 ATF_REQUIRE_EQ("false", templates.evaluate("defined(the-variabl)")); in ATF_TEST_CASE_BODY()
311 ATF_REQUIRE_EQ("false", templates.evaluate("defined(the-vecto)")); in ATF_TEST_CASE_BODY()
312 ATF_REQUIRE_EQ("true", templates.evaluate("defined(the-variable)")); in ATF_TEST_CASE_BODY()
313 ATF_REQUIRE_EQ("true", templates.evaluate("defined(the-vector)")); in ATF_TEST_CASE_BODY()
320 text::templates_def templates; in ATF_TEST_CASE_BODY() local
321 templates.add_vector("v"); in ATF_TEST_CASE_BODY()
322 ATF_REQUIRE_EQ("0", templates.evaluate("length(v)")); in ATF_TEST_CASE_BODY()
323 templates.add_to_vector("v", "foo"); in ATF_TEST_CASE_BODY()
324 ATF_REQUIRE_EQ("1", templates.evaluate("length(v)")); in ATF_TEST_CASE_BODY()
325 templates.add_to_vector("v", "bar"); in ATF_TEST_CASE_BODY()
326 ATF_REQUIRE_EQ("2", templates.evaluate("length(v)")); in ATF_TEST_CASE_BODY()
327 templates.add_to_vector("v", "baz"); in ATF_TEST_CASE_BODY()
328 ATF_REQUIRE_EQ("3", templates.evaluate("length(v)")); in ATF_TEST_CASE_BODY()
335 text::templates_def templates; in ATF_TEST_CASE_BODY() local
336 templates.add_vector("foo1"); in ATF_TEST_CASE_BODY()
338 templates.evaluate("length(foo)")); in ATF_TEST_CASE_BODY()
345 text::templates_def templates; in ATF_TEST_CASE_BODY() local
348 templates.evaluate("foo(abc")); in ATF_TEST_CASE_BODY()
351 templates.evaluate("a(b)c")); in ATF_TEST_CASE_BODY()
358 const text::templates_def templates; in ATF_TEST_CASE_BODY() local
359 do_test_ok(templates, "", ""); in ATF_TEST_CASE_BODY()
380 text::templates_def templates; in ATF_TEST_CASE_BODY() local
381 templates.add_variable("testvar1", "second line"); in ATF_TEST_CASE_BODY()
382 templates.add_variable("testvar2", "fourth"); in ATF_TEST_CASE_BODY()
383 templates.add_variable("testvar3", "line"); in ATF_TEST_CASE_BODY()
384 templates.add_variable("testvar4", "."); in ATF_TEST_CASE_BODY()
386 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
396 text::templates_def templates; in ATF_TEST_CASE_BODY() local
397 templates.add_variable("testvar2", "fourth line"); in ATF_TEST_CASE_BODY()
399 do_test_fail(templates, input, "Unknown variable 'testvar1'"); in ATF_TEST_CASE_BODY()
414 text::templates_def templates; in ATF_TEST_CASE_BODY() local
415 templates.add_vector("testvector1"); in ATF_TEST_CASE_BODY()
416 templates.add_to_vector("testvector1", "000"); in ATF_TEST_CASE_BODY()
417 templates.add_to_vector("testvector1", "111"); in ATF_TEST_CASE_BODY()
418 templates.add_to_vector("testvector1", "543"); in ATF_TEST_CASE_BODY()
419 templates.add_to_vector("testvector1", "999"); in ATF_TEST_CASE_BODY()
420 templates.add_vector("testvector2"); in ATF_TEST_CASE_BODY()
421 templates.add_vector("testvector3"); in ATF_TEST_CASE_BODY()
422 templates.add_to_vector("testvector3", "123"); in ATF_TEST_CASE_BODY()
424 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
434 text::templates_def templates; in ATF_TEST_CASE_BODY() local
435 templates.add_vector("testvector2"); in ATF_TEST_CASE_BODY()
437 do_test_fail(templates, input, "Unknown vector 'testvector'"); in ATF_TEST_CASE_BODY()
458 text::templates_def templates; in ATF_TEST_CASE_BODY() local
459 templates.add_variable("i", "2"); in ATF_TEST_CASE_BODY()
460 templates.add_variable("j", "0"); in ATF_TEST_CASE_BODY()
461 templates.add_vector("testvector1"); in ATF_TEST_CASE_BODY()
462 templates.add_to_vector("testvector1", "000"); in ATF_TEST_CASE_BODY()
463 templates.add_to_vector("testvector1", "111"); in ATF_TEST_CASE_BODY()
464 templates.add_to_vector("testvector1", "543"); in ATF_TEST_CASE_BODY()
465 templates.add_to_vector("testvector1", "999"); in ATF_TEST_CASE_BODY()
466 templates.add_vector("testvector2"); in ATF_TEST_CASE_BODY()
467 templates.add_to_vector("testvector2", "123"); in ATF_TEST_CASE_BODY()
469 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
479 text::templates_def templates; in ATF_TEST_CASE_BODY() local
480 templates.add_vector("testvector2"); in ATF_TEST_CASE_BODY()
482 do_test_fail(templates, input, "Unknown vector 'testvector'"); in ATF_TEST_CASE_BODY()
492 text::templates_def templates; in ATF_TEST_CASE_BODY() local
493 templates.add_vector("testvector"); in ATF_TEST_CASE_BODY()
494 templates.add_variable("j", "0"); in ATF_TEST_CASE_BODY()
496 do_test_fail(templates, input, "Index 'j' out of range at position '0'"); in ATF_TEST_CASE_BODY()
506 text::templates_def templates; in ATF_TEST_CASE_BODY() local
507 templates.add_vector("testvector"); in ATF_TEST_CASE_BODY()
508 templates.add_to_vector("testvector", "a"); in ATF_TEST_CASE_BODY()
509 templates.add_to_vector("testvector", "b"); in ATF_TEST_CASE_BODY()
510 templates.add_variable("j", "2"); in ATF_TEST_CASE_BODY()
512 do_test_fail(templates, input, "Index 'j' out of range at position '2'"); in ATF_TEST_CASE_BODY()
537 text::templates_def templates; in ATF_TEST_CASE_BODY() local
538 templates.add_variable("some_var", "zzz"); in ATF_TEST_CASE_BODY()
539 templates.add_vector("some_vector"); in ATF_TEST_CASE_BODY()
541 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
565 text::templates_def templates; in ATF_TEST_CASE_BODY() local
567 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
604 text::templates_def templates; in ATF_TEST_CASE_BODY() local
605 templates.add_variable("var1", "false"); in ATF_TEST_CASE_BODY()
606 templates.add_vector("var2"); in ATF_TEST_CASE_BODY()
607 templates.add_to_vector("var2", "not-empty"); in ATF_TEST_CASE_BODY()
608 templates.add_variable("var3", "foobar"); in ATF_TEST_CASE_BODY()
610 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
645 text::templates_def templates; in ATF_TEST_CASE_BODY() local
646 templates.add_variable("var1", "false"); in ATF_TEST_CASE_BODY()
647 templates.add_vector("var2"); in ATF_TEST_CASE_BODY()
648 templates.add_vector("var3"); in ATF_TEST_CASE_BODY()
650 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
670 text::templates_def templates; in ATF_TEST_CASE_BODY() local
671 templates.add_variable("var1", "defined"); in ATF_TEST_CASE_BODY()
672 templates.add_vector("table1"); in ATF_TEST_CASE_BODY()
674 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
694 text::templates_def templates; in ATF_TEST_CASE_BODY() local
695 templates.add_vector("table1"); in ATF_TEST_CASE_BODY()
696 templates.add_to_vector("table1", "foo1"); in ATF_TEST_CASE_BODY()
697 templates.add_to_vector("table1", "bar1"); in ATF_TEST_CASE_BODY()
698 templates.add_vector("table2"); in ATF_TEST_CASE_BODY()
699 templates.add_to_vector("table2", "foo2"); in ATF_TEST_CASE_BODY()
700 templates.add_to_vector("table2", "bar2"); in ATF_TEST_CASE_BODY()
702 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
732 text::templates_def templates; in ATF_TEST_CASE_BODY() local
733 templates.add_vector("table1"); in ATF_TEST_CASE_BODY()
734 templates.add_to_vector("table1", "a"); in ATF_TEST_CASE_BODY()
735 templates.add_to_vector("table1", "b"); in ATF_TEST_CASE_BODY()
736 templates.add_vector("table2"); in ATF_TEST_CASE_BODY()
737 templates.add_vector("table3"); in ATF_TEST_CASE_BODY()
738 templates.add_to_vector("table3", "1"); in ATF_TEST_CASE_BODY()
740 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
766 text::templates_def templates; in ATF_TEST_CASE_BODY() local
767 templates.add_vector("table1"); in ATF_TEST_CASE_BODY()
768 templates.add_to_vector("table1", "a"); in ATF_TEST_CASE_BODY()
769 templates.add_to_vector("table1", "b"); in ATF_TEST_CASE_BODY()
770 templates.add_vector("table2"); in ATF_TEST_CASE_BODY()
771 templates.add_to_vector("table2", "1"); in ATF_TEST_CASE_BODY()
772 templates.add_to_vector("table2", "2"); in ATF_TEST_CASE_BODY()
773 templates.add_to_vector("table2", "3"); in ATF_TEST_CASE_BODY()
775 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
813 text::templates_def templates; in ATF_TEST_CASE_BODY() local
814 templates.add_vector("table1"); in ATF_TEST_CASE_BODY()
815 templates.add_to_vector("table1", "a"); in ATF_TEST_CASE_BODY()
816 templates.add_to_vector("table1", "b"); in ATF_TEST_CASE_BODY()
817 templates.add_vector("table2"); in ATF_TEST_CASE_BODY()
818 templates.add_vector("table3"); in ATF_TEST_CASE_BODY()
819 templates.add_vector("table4"); in ATF_TEST_CASE_BODY()
820 templates.add_to_vector("table4", "1"); in ATF_TEST_CASE_BODY()
821 templates.add_to_vector("table4", "2"); in ATF_TEST_CASE_BODY()
822 templates.add_to_vector("table4", "3"); in ATF_TEST_CASE_BODY()
824 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
851 text::templates_def templates; in ATF_TEST_CASE_BODY() local
852 templates.add_vector("table1"); in ATF_TEST_CASE_BODY()
853 templates.add_to_vector("table1", "first"); in ATF_TEST_CASE_BODY()
854 templates.add_to_vector("table1", "second"); in ATF_TEST_CASE_BODY()
855 templates.add_vector("table2"); in ATF_TEST_CASE_BODY()
856 templates.add_to_vector("table2", "first"); in ATF_TEST_CASE_BODY()
858 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
873 text::templates_def templates; in ATF_TEST_CASE_BODY() local
874 templates.add_variable("var", "some more"); in ATF_TEST_CASE_BODY()
876 do_test_ok(templates, input, exp_output); in ATF_TEST_CASE_BODY()
905 text::templates_def templates; in ATF_TEST_CASE_BODY() local
906 templates.add_variable("string", "Hello, world!"); in ATF_TEST_CASE_BODY()
910 text::instantiate(templates, fs::path("input.txt"), fs::path("output.txt")); in ATF_TEST_CASE_BODY()
923 text::templates_def templates; in ATF_TEST_CASE_BODY() local
925 text::instantiate(templates, fs::path("input.txt"), in ATF_TEST_CASE_BODY()
937 text::templates_def templates; in ATF_TEST_CASE_BODY() local
944 text::instantiate(templates, fs::path("input.txt"), in ATF_TEST_CASE_BODY()