aboutsummaryrefslogtreecommitdiff
path: root/lib/mstch/test/data
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mstch/test/data')
-rw-r--r--lib/mstch/test/data/ampersand_escape.hpp3
-rw-r--r--lib/mstch/test/data/ampersand_escape.mustache1
-rw-r--r--lib/mstch/test/data/ampersand_escape.txt1
-rw-r--r--lib/mstch/test/data/apostrophe.hpp4
-rw-r--r--lib/mstch/test/data/apostrophe.mustache1
-rw-r--r--lib/mstch/test/data/apostrophe.txt1
-rw-r--r--lib/mstch/test/data/array_of_strings.hpp3
-rw-r--r--lib/mstch/test/data/array_of_strings.mustache1
-rw-r--r--lib/mstch/test/data/array_of_strings.txt1
-rw-r--r--lib/mstch/test/data/backslashes.hpp3
-rw-r--r--lib/mstch/test/data/backslashes.mustache7
-rw-r--r--lib/mstch/test/data/backslashes.txt7
-rw-r--r--lib/mstch/test/data/bug_11_eating_whitespace.hpp3
-rw-r--r--lib/mstch/test/data/bug_11_eating_whitespace.mustache1
-rw-r--r--lib/mstch/test/data/bug_11_eating_whitespace.txt1
-rw-r--r--lib/mstch/test/data/bug_length_property.hpp3
-rw-r--r--lib/mstch/test/data/bug_length_property.mustache1
-rw-r--r--lib/mstch/test/data/bug_length_property.txt1
-rw-r--r--lib/mstch/test/data/changing_delimiters.hpp4
-rw-r--r--lib/mstch/test/data/changing_delimiters.mustache1
-rw-r--r--lib/mstch/test/data/changing_delimiters.txt1
-rw-r--r--lib/mstch/test/data/comments.hpp3
-rw-r--r--lib/mstch/test/data/comments.mustache1
-rw-r--r--lib/mstch/test/data/comments.txt1
-rw-r--r--lib/mstch/test/data/complex.hpp69
-rw-r--r--lib/mstch/test/data/complex.mustache16
-rw-r--r--lib/mstch/test/data/complex.txt6
-rw-r--r--lib/mstch/test/data/context_lookup.hpp8
-rw-r--r--lib/mstch/test/data/context_lookup.mustache1
-rw-r--r--lib/mstch/test/data/context_lookup.txt1
-rw-r--r--lib/mstch/test/data/delimiters.hpp6
-rw-r--r--lib/mstch/test/data/delimiters.mustache7
-rw-r--r--lib/mstch/test/data/delimiters.txt5
-rw-r--r--lib/mstch/test/data/disappearing_whitespace.hpp4
-rw-r--r--lib/mstch/test/data/disappearing_whitespace.mustache1
-rw-r--r--lib/mstch/test/data/disappearing_whitespace.txt1
-rw-r--r--lib/mstch/test/data/dot_notation.hpp34
-rw-r--r--lib/mstch/test/data/dot_notation.mustache9
-rw-r--r--lib/mstch/test/data/dot_notation.txt9
-rw-r--r--lib/mstch/test/data/double_render.hpp5
-rw-r--r--lib/mstch/test/data/double_render.mustache1
-rw-r--r--lib/mstch/test/data/double_render.txt1
-rw-r--r--lib/mstch/test/data/empty_list.hpp3
-rw-r--r--lib/mstch/test/data/empty_list.mustache4
-rw-r--r--lib/mstch/test/data/empty_list.txt1
-rw-r--r--lib/mstch/test/data/empty_sections.hpp1
-rw-r--r--lib/mstch/test/data/empty_sections.mustache1
-rw-r--r--lib/mstch/test/data/empty_sections.txt1
-rw-r--r--lib/mstch/test/data/empty_string.hpp6
-rw-r--r--lib/mstch/test/data/empty_string.mustache1
-rw-r--r--lib/mstch/test/data/empty_string.txt1
-rw-r--r--lib/mstch/test/data/empty_template.hpp1
-rw-r--r--lib/mstch/test/data/empty_template.mustache1
-rw-r--r--lib/mstch/test/data/empty_template.txt1
-rw-r--r--lib/mstch/test/data/error_eof_in_section.hpp3
-rw-r--r--lib/mstch/test/data/error_eof_in_section.mustache1
-rw-r--r--lib/mstch/test/data/error_eof_in_section.txt1
-rw-r--r--lib/mstch/test/data/error_eof_in_tag.hpp1
-rw-r--r--lib/mstch/test/data/error_eof_in_tag.mustache1
-rw-r--r--lib/mstch/test/data/error_eof_in_tag.txt1
-rw-r--r--lib/mstch/test/data/error_not_found.hpp3
-rw-r--r--lib/mstch/test/data/error_not_found.mustache1
-rw-r--r--lib/mstch/test/data/error_not_found.txt0
-rw-r--r--lib/mstch/test/data/escaped.hpp4
-rw-r--r--lib/mstch/test/data/escaped.mustache2
-rw-r--r--lib/mstch/test/data/escaped.txt2
-rw-r--r--lib/mstch/test/data/falsy.hpp6
-rw-r--r--lib/mstch/test/data/falsy.mustache8
-rw-r--r--lib/mstch/test/data/falsy.txt8
-rw-r--r--lib/mstch/test/data/falsy_array.hpp8
-rw-r--r--lib/mstch/test/data/falsy_array.mustache3
-rw-r--r--lib/mstch/test/data/falsy_array.txt4
-rw-r--r--lib/mstch/test/data/grandparent_context.hpp19
-rw-r--r--lib/mstch/test/data/grandparent_context.mustache10
-rw-r--r--lib/mstch/test/data/grandparent_context.txt17
-rw-r--r--lib/mstch/test/data/higher_order_sections.hpp28
-rw-r--r--lib/mstch/test/data/higher_order_sections.mustache1
-rw-r--r--lib/mstch/test/data/higher_order_sections.txt1
-rw-r--r--lib/mstch/test/data/implicit_iterator.hpp8
-rw-r--r--lib/mstch/test/data/implicit_iterator.mustache7
-rw-r--r--lib/mstch/test/data/implicit_iterator.txt3
-rw-r--r--lib/mstch/test/data/included_tag.hpp3
-rw-r--r--lib/mstch/test/data/included_tag.mustache1
-rw-r--r--lib/mstch/test/data/included_tag.txt1
-rw-r--r--lib/mstch/test/data/inverted_section.hpp3
-rw-r--r--lib/mstch/test/data/inverted_section.mustache3
-rw-r--r--lib/mstch/test/data/inverted_section.txt3
-rw-r--r--lib/mstch/test/data/keys_with_questionmarks.hpp5
-rw-r--r--lib/mstch/test/data/keys_with_questionmarks.mustache3
-rw-r--r--lib/mstch/test/data/keys_with_questionmarks.txt1
-rw-r--r--lib/mstch/test/data/multiline_comment.hpp1
-rw-r--r--lib/mstch/test/data/multiline_comment.mustache6
-rw-r--r--lib/mstch/test/data/multiline_comment.txt1
-rw-r--r--lib/mstch/test/data/nested_dot.hpp1
-rw-r--r--lib/mstch/test/data/nested_dot.mustache1
-rw-r--r--lib/mstch/test/data/nested_dot.txt1
-rw-r--r--lib/mstch/test/data/nested_higher_order_sections.hpp6
-rw-r--r--lib/mstch/test/data/nested_higher_order_sections.mustache1
-rw-r--r--lib/mstch/test/data/nested_higher_order_sections.txt1
-rw-r--r--lib/mstch/test/data/nested_iterating.hpp8
-rw-r--r--lib/mstch/test/data/nested_iterating.mustache1
-rw-r--r--lib/mstch/test/data/nested_iterating.txt1
-rw-r--r--lib/mstch/test/data/nesting.hpp7
-rw-r--r--lib/mstch/test/data/nesting.mustache5
-rw-r--r--lib/mstch/test/data/nesting.txt3
-rw-r--r--lib/mstch/test/data/nesting_same_name.hpp8
-rw-r--r--lib/mstch/test/data/nesting_same_name.mustache1
-rw-r--r--lib/mstch/test/data/nesting_same_name.txt1
-rw-r--r--lib/mstch/test/data/null_lookup_array.hpp8
-rw-r--r--lib/mstch/test/data/null_lookup_array.mustache3
-rw-r--r--lib/mstch/test/data/null_lookup_array.txt2
-rw-r--r--lib/mstch/test/data/null_lookup_object.hpp14
-rw-r--r--lib/mstch/test/data/null_lookup_object.mustache3
-rw-r--r--lib/mstch/test/data/null_lookup_object.txt2
-rw-r--r--lib/mstch/test/data/null_string.hpp6
-rw-r--r--lib/mstch/test/data/null_string.mustache4
-rw-r--r--lib/mstch/test/data/null_string.txt4
-rw-r--r--lib/mstch/test/data/null_view.hpp4
-rw-r--r--lib/mstch/test/data/null_view.mustache1
-rw-r--r--lib/mstch/test/data/null_view.txt1
-rw-r--r--lib/mstch/test/data/partial_array.hpp3
-rw-r--r--lib/mstch/test/data/partial_array.mustache1
-rw-r--r--lib/mstch/test/data/partial_array.partial4
-rw-r--r--lib/mstch/test/data/partial_array.txt5
-rw-r--r--lib/mstch/test/data/partial_array_of_partials.hpp8
-rw-r--r--lib/mstch/test/data/partial_array_of_partials.mustache4
-rw-r--r--lib/mstch/test/data/partial_array_of_partials.partial1
-rw-r--r--lib/mstch/test/data/partial_array_of_partials.txt5
-rw-r--r--lib/mstch/test/data/partial_array_of_partials_implicit.hpp3
-rw-r--r--lib/mstch/test/data/partial_array_of_partials_implicit.mustache4
-rw-r--r--lib/mstch/test/data/partial_array_of_partials_implicit.partial1
-rw-r--r--lib/mstch/test/data/partial_array_of_partials_implicit.txt5
-rw-r--r--lib/mstch/test/data/partial_empty.hpp3
-rw-r--r--lib/mstch/test/data/partial_empty.mustache2
-rw-r--r--lib/mstch/test/data/partial_empty.partial0
-rw-r--r--lib/mstch/test/data/partial_empty.txt1
-rw-r--r--lib/mstch/test/data/partial_template.hpp4
-rw-r--r--lib/mstch/test/data/partial_template.mustache2
-rw-r--r--lib/mstch/test/data/partial_template.partial1
-rw-r--r--lib/mstch/test/data/partial_template.txt2
-rw-r--r--lib/mstch/test/data/partial_view.hpp42
-rw-r--r--lib/mstch/test/data/partial_view.mustache3
-rw-r--r--lib/mstch/test/data/partial_view.partial5
-rw-r--r--lib/mstch/test/data/partial_view.txt5
-rw-r--r--lib/mstch/test/data/partial_whitespace.hpp41
-rw-r--r--lib/mstch/test/data/partial_whitespace.mustache3
-rw-r--r--lib/mstch/test/data/partial_whitespace.partial5
-rw-r--r--lib/mstch/test/data/partial_whitespace.txt5
-rw-r--r--lib/mstch/test/data/recursion_with_same_names.hpp8
-rw-r--r--lib/mstch/test/data/recursion_with_same_names.mustache7
-rw-r--r--lib/mstch/test/data/recursion_with_same_names.txt7
-rw-r--r--lib/mstch/test/data/reuse_of_enumerables.hpp6
-rw-r--r--lib/mstch/test/data/reuse_of_enumerables.mustache8
-rw-r--r--lib/mstch/test/data/reuse_of_enumerables.txt8
-rw-r--r--lib/mstch/test/data/section_as_context.hpp10
-rw-r--r--lib/mstch/test/data/section_as_context.mustache9
-rw-r--r--lib/mstch/test/data/section_as_context.txt6
-rw-r--r--lib/mstch/test/data/section_functions_in_partials.hpp5
-rw-r--r--lib/mstch/test/data/section_functions_in_partials.mustache3
-rw-r--r--lib/mstch/test/data/section_functions_in_partials.partial1
-rw-r--r--lib/mstch/test/data/section_functions_in_partials.txt3
-rw-r--r--lib/mstch/test/data/simple.hpp32
-rw-r--r--lib/mstch/test/data/simple.mustache5
-rw-r--r--lib/mstch/test/data/simple.txt3
-rw-r--r--lib/mstch/test/data/string_as_context.hpp4
-rw-r--r--lib/mstch/test/data/string_as_context.mustache5
-rw-r--r--lib/mstch/test/data/string_as_context.txt5
-rw-r--r--lib/mstch/test/data/two_in_a_row.hpp4
-rw-r--r--lib/mstch/test/data/two_in_a_row.mustache1
-rw-r--r--lib/mstch/test/data/two_in_a_row.txt1
-rw-r--r--lib/mstch/test/data/two_sections.hpp1
-rw-r--r--lib/mstch/test/data/two_sections.mustache4
-rw-r--r--lib/mstch/test/data/two_sections.txt0
-rw-r--r--lib/mstch/test/data/unescaped.hpp3
-rw-r--r--lib/mstch/test/data/unescaped.mustache1
-rw-r--r--lib/mstch/test/data/unescaped.txt1
-rw-r--r--lib/mstch/test/data/whitespace.hpp4
-rw-r--r--lib/mstch/test/data/whitespace.mustache4
-rw-r--r--lib/mstch/test/data/whitespace.txt4
-rw-r--r--lib/mstch/test/data/zero_view.hpp1
-rw-r--r--lib/mstch/test/data/zero_view.mustache1
-rw-r--r--lib/mstch/test/data/zero_view.txt1
182 files changed, 874 insertions, 0 deletions
diff --git a/lib/mstch/test/data/ampersand_escape.hpp b/lib/mstch/test/data/ampersand_escape.hpp
new file mode 100644
index 0000000..b307d50
--- /dev/null
+++ b/lib/mstch/test/data/ampersand_escape.hpp
@@ -0,0 +1,3 @@
+const auto ampersand_escape_data = mstch::map{
+ {"message", std::string{"Some <code>"}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/ampersand_escape.mustache b/lib/mstch/test/data/ampersand_escape.mustache
new file mode 100644
index 0000000..6501a48
--- /dev/null
+++ b/lib/mstch/test/data/ampersand_escape.mustache
@@ -0,0 +1 @@
+{{&message}}
diff --git a/lib/mstch/test/data/ampersand_escape.txt b/lib/mstch/test/data/ampersand_escape.txt
new file mode 100644
index 0000000..2ed3fd3
--- /dev/null
+++ b/lib/mstch/test/data/ampersand_escape.txt
@@ -0,0 +1 @@
+Some <code>
diff --git a/lib/mstch/test/data/apostrophe.hpp b/lib/mstch/test/data/apostrophe.hpp
new file mode 100644
index 0000000..94738f4
--- /dev/null
+++ b/lib/mstch/test/data/apostrophe.hpp
@@ -0,0 +1,4 @@
+const auto apostrophe_data = mstch::map{
+ {"apos", std::string{"'"}},
+ {"control", std::string{"X"}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/apostrophe.mustache b/lib/mstch/test/data/apostrophe.mustache
new file mode 100644
index 0000000..e8687aa
--- /dev/null
+++ b/lib/mstch/test/data/apostrophe.mustache
@@ -0,0 +1 @@
+{{apos}}{{control}}
diff --git a/lib/mstch/test/data/apostrophe.txt b/lib/mstch/test/data/apostrophe.txt
new file mode 100644
index 0000000..4427c30
--- /dev/null
+++ b/lib/mstch/test/data/apostrophe.txt
@@ -0,0 +1 @@
+&#39;X
diff --git a/lib/mstch/test/data/array_of_strings.hpp b/lib/mstch/test/data/array_of_strings.hpp
new file mode 100644
index 0000000..5511c5d
--- /dev/null
+++ b/lib/mstch/test/data/array_of_strings.hpp
@@ -0,0 +1,3 @@
+const auto array_of_strings_data = mstch::map{
+ {"array_of_strings", mstch::array{std::string{"hello"}, std::string{"world"}}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/array_of_strings.mustache b/lib/mstch/test/data/array_of_strings.mustache
new file mode 100644
index 0000000..4d65738
--- /dev/null
+++ b/lib/mstch/test/data/array_of_strings.mustache
@@ -0,0 +1 @@
+{{#array_of_strings}}{{.}} {{/array_of_strings}}
diff --git a/lib/mstch/test/data/array_of_strings.txt b/lib/mstch/test/data/array_of_strings.txt
new file mode 100644
index 0000000..4a1f475
--- /dev/null
+++ b/lib/mstch/test/data/array_of_strings.txt
@@ -0,0 +1 @@
+hello world
diff --git a/lib/mstch/test/data/backslashes.hpp b/lib/mstch/test/data/backslashes.hpp
new file mode 100644
index 0000000..7969339
--- /dev/null
+++ b/lib/mstch/test/data/backslashes.hpp
@@ -0,0 +1,3 @@
+const auto backslashes_data = mstch::map{
+ {"value", std::string{"\\abc"}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/backslashes.mustache b/lib/mstch/test/data/backslashes.mustache
new file mode 100644
index 0000000..fe7745b
--- /dev/null
+++ b/lib/mstch/test/data/backslashes.mustache
@@ -0,0 +1,7 @@
+* {{value}}
+* {{{value}}}
+* {{&value}}
+<script>
+foo = { bar: 'abc\"xyz\"' };
+foo = { bar: 'x\'y' };
+</script>
diff --git a/lib/mstch/test/data/backslashes.txt b/lib/mstch/test/data/backslashes.txt
new file mode 100644
index 0000000..038dd37
--- /dev/null
+++ b/lib/mstch/test/data/backslashes.txt
@@ -0,0 +1,7 @@
+* \abc
+* \abc
+* \abc
+<script>
+foo = { bar: 'abc\"xyz\"' };
+foo = { bar: 'x\'y' };
+</script>
diff --git a/lib/mstch/test/data/bug_11_eating_whitespace.hpp b/lib/mstch/test/data/bug_11_eating_whitespace.hpp
new file mode 100644
index 0000000..57ce819
--- /dev/null
+++ b/lib/mstch/test/data/bug_11_eating_whitespace.hpp
@@ -0,0 +1,3 @@
+const auto bug_11_eating_whitespace_data = mstch::map{
+ {"tag", std::string{"yo"}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/bug_11_eating_whitespace.mustache b/lib/mstch/test/data/bug_11_eating_whitespace.mustache
new file mode 100644
index 0000000..8d5cd92
--- /dev/null
+++ b/lib/mstch/test/data/bug_11_eating_whitespace.mustache
@@ -0,0 +1 @@
+{{tag}} foo
diff --git a/lib/mstch/test/data/bug_11_eating_whitespace.txt b/lib/mstch/test/data/bug_11_eating_whitespace.txt
new file mode 100644
index 0000000..f5bbc85
--- /dev/null
+++ b/lib/mstch/test/data/bug_11_eating_whitespace.txt
@@ -0,0 +1 @@
+yo foo
diff --git a/lib/mstch/test/data/bug_length_property.hpp b/lib/mstch/test/data/bug_length_property.hpp
new file mode 100644
index 0000000..533b596
--- /dev/null
+++ b/lib/mstch/test/data/bug_length_property.hpp
@@ -0,0 +1,3 @@
+const auto bug_length_property_data = mstch::map{
+ {"length", std::string{"hello"}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/bug_length_property.mustache b/lib/mstch/test/data/bug_length_property.mustache
new file mode 100644
index 0000000..b000887
--- /dev/null
+++ b/lib/mstch/test/data/bug_length_property.mustache
@@ -0,0 +1 @@
+{{#length}}The length variable is: {{length}}{{/length}}
diff --git a/lib/mstch/test/data/bug_length_property.txt b/lib/mstch/test/data/bug_length_property.txt
new file mode 100644
index 0000000..f5355d3
--- /dev/null
+++ b/lib/mstch/test/data/bug_length_property.txt
@@ -0,0 +1 @@
+The length variable is: hello
diff --git a/lib/mstch/test/data/changing_delimiters.hpp b/lib/mstch/test/data/changing_delimiters.hpp
new file mode 100644
index 0000000..1322543
--- /dev/null
+++ b/lib/mstch/test/data/changing_delimiters.hpp
@@ -0,0 +1,4 @@
+const mstch::node changing_delimiters_data = mstch::map{
+ {"foo", std::string{"foooooooooooooo"}},
+ {"bar", std::string{"<b>bar!</b>"}}
+};
diff --git a/lib/mstch/test/data/changing_delimiters.mustache b/lib/mstch/test/data/changing_delimiters.mustache
new file mode 100644
index 0000000..0cd044c
--- /dev/null
+++ b/lib/mstch/test/data/changing_delimiters.mustache
@@ -0,0 +1 @@
+{{=<% %>=}}<% foo %> {{foo}} <%{bar}%> {{{bar}}}
diff --git a/lib/mstch/test/data/changing_delimiters.txt b/lib/mstch/test/data/changing_delimiters.txt
new file mode 100644
index 0000000..1b1510d
--- /dev/null
+++ b/lib/mstch/test/data/changing_delimiters.txt
@@ -0,0 +1 @@
+foooooooooooooo {{foo}} <b>bar!</b> {{{bar}}}
diff --git a/lib/mstch/test/data/comments.hpp b/lib/mstch/test/data/comments.hpp
new file mode 100644
index 0000000..96baccb
--- /dev/null
+++ b/lib/mstch/test/data/comments.hpp
@@ -0,0 +1,3 @@
+const mstch::node comments_data = mstch::map{
+ {"title", mstch::lambda{[]()->mstch::node{return std::string{"A Comedy of Errors"};}}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/comments.mustache b/lib/mstch/test/data/comments.mustache
new file mode 100644
index 0000000..5036801
--- /dev/null
+++ b/lib/mstch/test/data/comments.mustache
@@ -0,0 +1 @@
+<h1>{{title}}{{! just something interesting... or not... }}</h1>
diff --git a/lib/mstch/test/data/comments.txt b/lib/mstch/test/data/comments.txt
new file mode 100644
index 0000000..0133517
--- /dev/null
+++ b/lib/mstch/test/data/comments.txt
@@ -0,0 +1 @@
+<h1>A Comedy of Errors</h1>
diff --git a/lib/mstch/test/data/complex.hpp b/lib/mstch/test/data/complex.hpp
new file mode 100644
index 0000000..a438098
--- /dev/null
+++ b/lib/mstch/test/data/complex.hpp
@@ -0,0 +1,69 @@
+class complex_item: public mstch::object {
+private:
+ std::string m_name;
+ bool m_current;
+ std::string m_url;
+public:
+ complex_item(const std::string& name, bool current, const std::string& url):
+ m_name(name), m_current(current), m_url(url)
+ {
+ register_methods(this, std::map<std::string,mstch::node(complex_item::*)()>{
+ {"name", &complex_item::name}, {"current", &complex_item::current},
+ {"url", &complex_item::url}, {"link", &complex_item::link}
+ });
+ }
+
+ mstch::node current() {
+ return m_current;
+ }
+
+ mstch::node url() {
+ return m_url;
+ }
+
+ mstch::node name() {
+ return m_name;
+ }
+
+ mstch::node link() {
+ return !m_current;
+ }
+};
+
+class complex: public mstch::object {
+private:
+ std::string m_header;
+ mstch::array m_item;
+public:
+ complex():
+ m_header("Colors"),
+ m_item(mstch::array{
+ std::make_shared<complex_item>("red", true, "#Red"),
+ std::make_shared<complex_item>("green", false, "#Green"),
+ std::make_shared<complex_item>("blue", false, "#Blue")
+ })
+ {
+ register_methods(this, std::map<std::string,mstch::node(complex::*)()>{
+ {"header", &complex::header}, {"item", &complex::item},
+ {"list", &complex::list}, {"empty", &complex::empty}
+ });
+ }
+
+ mstch::node header() {
+ return m_header;
+ }
+
+ mstch::node item() {
+ return m_item;
+ }
+
+ mstch::node list() {
+ return m_item.size() != 0;
+ }
+
+ mstch::node empty() {
+ return m_item.size() == 0;
+ }
+};
+
+const auto complex_data = std::make_shared<complex>(); \ No newline at end of file
diff --git a/lib/mstch/test/data/complex.mustache b/lib/mstch/test/data/complex.mustache
new file mode 100644
index 0000000..869a4f0
--- /dev/null
+++ b/lib/mstch/test/data/complex.mustache
@@ -0,0 +1,16 @@
+<h1>{{header}}</h1>
+{{#list}}
+ <ul>
+ {{#item}}
+ {{#current}}
+ <li><strong>{{name}}</strong></li>
+ {{/current}}
+ {{#link}}
+ <li><a href="{{url}}">{{name}}</a></li>
+ {{/link}}
+ {{/item}}
+ </ul>
+{{/list}}
+{{#empty}}
+ <p>The list is empty.</p>
+{{/empty}}
diff --git a/lib/mstch/test/data/complex.txt b/lib/mstch/test/data/complex.txt
new file mode 100644
index 0000000..596d3f6
--- /dev/null
+++ b/lib/mstch/test/data/complex.txt
@@ -0,0 +1,6 @@
+<h1>Colors</h1>
+ <ul>
+ <li><strong>red</strong></li>
+ <li><a href="#Green">green</a></li>
+ <li><a href="#Blue">blue</a></li>
+ </ul>
diff --git a/lib/mstch/test/data/context_lookup.hpp b/lib/mstch/test/data/context_lookup.hpp
new file mode 100644
index 0000000..c799080
--- /dev/null
+++ b/lib/mstch/test/data/context_lookup.hpp
@@ -0,0 +1,8 @@
+const auto context_lookup_data = mstch::map{
+ {"outer", mstch::map{
+ {"id", 1},
+ {"second", mstch::map{
+ {"nothing", 2}
+ }}
+ }}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/context_lookup.mustache b/lib/mstch/test/data/context_lookup.mustache
new file mode 100644
index 0000000..3c7b767
--- /dev/null
+++ b/lib/mstch/test/data/context_lookup.mustache
@@ -0,0 +1 @@
+{{#outer}}{{#second}}{{id}}{{/second}}{{/outer}}
diff --git a/lib/mstch/test/data/context_lookup.txt b/lib/mstch/test/data/context_lookup.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/lib/mstch/test/data/context_lookup.txt
@@ -0,0 +1 @@
+1
diff --git a/lib/mstch/test/data/delimiters.hpp b/lib/mstch/test/data/delimiters.hpp
new file mode 100644
index 0000000..0e560ab
--- /dev/null
+++ b/lib/mstch/test/data/delimiters.hpp
@@ -0,0 +1,6 @@
+const mstch::node delimiters_data = mstch::map{
+ {"first", std::string{"It worked the first time."}},
+ {"second", std::string{"And it worked the second time."}},
+ {"third", std::string{"Then, surprisingly, it worked the third time."}},
+ {"fourth", std::string{"Fourth time also fine!."}}
+};
diff --git a/lib/mstch/test/data/delimiters.mustache b/lib/mstch/test/data/delimiters.mustache
new file mode 100644
index 0000000..7fac846
--- /dev/null
+++ b/lib/mstch/test/data/delimiters.mustache
@@ -0,0 +1,7 @@
+{{=<% %>=}}*
+<% first %>
+* <% second %>
+<%=| |=%>
+* | third |
+|={{ }}=|
+* {{ fourth }}
diff --git a/lib/mstch/test/data/delimiters.txt b/lib/mstch/test/data/delimiters.txt
new file mode 100644
index 0000000..698a6bb
--- /dev/null
+++ b/lib/mstch/test/data/delimiters.txt
@@ -0,0 +1,5 @@
+*
+It worked the first time.
+* And it worked the second time.
+* Then, surprisingly, it worked the third time.
+* Fourth time also fine!.
diff --git a/lib/mstch/test/data/disappearing_whitespace.hpp b/lib/mstch/test/data/disappearing_whitespace.hpp
new file mode 100644
index 0000000..5322fe4
--- /dev/null
+++ b/lib/mstch/test/data/disappearing_whitespace.hpp
@@ -0,0 +1,4 @@
+const auto disappearing_whitespace_data = mstch::map{
+ {"bedrooms", true},
+ {"total", 1}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/disappearing_whitespace.mustache b/lib/mstch/test/data/disappearing_whitespace.mustache
new file mode 100644
index 0000000..16c16e0
--- /dev/null
+++ b/lib/mstch/test/data/disappearing_whitespace.mustache
@@ -0,0 +1 @@
+{{#bedrooms}}{{total}}{{/bedrooms}} BED
diff --git a/lib/mstch/test/data/disappearing_whitespace.txt b/lib/mstch/test/data/disappearing_whitespace.txt
new file mode 100644
index 0000000..66e98ef
--- /dev/null
+++ b/lib/mstch/test/data/disappearing_whitespace.txt
@@ -0,0 +1 @@
+1 BED
diff --git a/lib/mstch/test/data/dot_notation.hpp b/lib/mstch/test/data/dot_notation.hpp
new file mode 100644
index 0000000..c287107
--- /dev/null
+++ b/lib/mstch/test/data/dot_notation.hpp
@@ -0,0 +1,34 @@
+class dot_notation_price: public mstch::object {
+private:
+ int m_value;
+ mstch::map m_currency;
+public:
+ dot_notation_price():
+ m_value(200), m_currency(mstch::map{{"symbol", std::string{"$"}}, {"name", std::string{"USD"}}})
+ {
+ register_methods(this, std::map<std::string,mstch::node(dot_notation_price::*)()>{
+ {"value", &dot_notation_price::value},
+ {"vat", &dot_notation_price::vat},
+ {"currency", &dot_notation_price::currency}});
+ }
+
+ mstch::node value() {
+ return m_value;
+ }
+
+ mstch::node vat() {
+ return m_value * 0.2;
+ }
+
+ mstch::node currency() {
+ return m_currency;
+ }
+};
+
+const auto dot_notation_data = mstch::map{
+ {"name", std::string{"A Book"}},
+ {"authors", mstch::array{std::string{"John Power"}, std::string{"Jamie Walsh"}}},
+ {"price", std::make_shared<dot_notation_price>()},
+ {"availability", mstch::map{{"status", true}, {"text", std::string{"In Stock"}}}},
+ {"truthy", mstch::map{{"zero", 0}, {"notTrue", false}}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/dot_notation.mustache b/lib/mstch/test/data/dot_notation.mustache
new file mode 100644
index 0000000..f89d70b
--- /dev/null
+++ b/lib/mstch/test/data/dot_notation.mustache
@@ -0,0 +1,9 @@
+<!-- exciting part -->
+<h1>{{name}}</h1>
+<p>Authors: <ul>{{#authors}}<li>{{.}}</li>{{/authors}}</ul></p>
+<p>Price: {{{price.currency.symbol}}}{{price.value}} {{#price.currency}}{{name}} <b>{{availability.text}}</b>{{/price.currency}}</p>
+<p>VAT: {{{price.currency.symbol}}}{{#price}}{{vat}}{{/price}}</p>
+<!-- boring part -->
+<h2>Test truthy false values:</h2>
+<p>Zero: {{truthy.zero}}</p>
+<p>False: {{truthy.notTrue}}</p>
diff --git a/lib/mstch/test/data/dot_notation.txt b/lib/mstch/test/data/dot_notation.txt
new file mode 100644
index 0000000..08afa05
--- /dev/null
+++ b/lib/mstch/test/data/dot_notation.txt
@@ -0,0 +1,9 @@
+<!-- exciting part -->
+<h1>A Book</h1>
+<p>Authors: <ul><li>John Power</li><li>Jamie Walsh</li></ul></p>
+<p>Price: $200 USD <b>In Stock</b></p>
+<p>VAT: $40</p>
+<!-- boring part -->
+<h2>Test truthy false values:</h2>
+<p>Zero: 0</p>
+<p>False: false</p>
diff --git a/lib/mstch/test/data/double_render.hpp b/lib/mstch/test/data/double_render.hpp
new file mode 100644
index 0000000..eb24dc1
--- /dev/null
+++ b/lib/mstch/test/data/double_render.hpp
@@ -0,0 +1,5 @@
+const auto double_render_data = mstch::map{
+ {"foo", true},
+ {"bar", std::string{"{{win}}"}},
+ {"win", std::string{"FAIL"}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/double_render.mustache b/lib/mstch/test/data/double_render.mustache
new file mode 100644
index 0000000..4500fd7
--- /dev/null
+++ b/lib/mstch/test/data/double_render.mustache
@@ -0,0 +1 @@
+{{#foo}}{{bar}}{{/foo}}
diff --git a/lib/mstch/test/data/double_render.txt b/lib/mstch/test/data/double_render.txt
new file mode 100644
index 0000000..b6e652d
--- /dev/null
+++ b/lib/mstch/test/data/double_render.txt
@@ -0,0 +1 @@
+{{win}}
diff --git a/lib/mstch/test/data/empty_list.hpp b/lib/mstch/test/data/empty_list.hpp
new file mode 100644
index 0000000..9a4d893
--- /dev/null
+++ b/lib/mstch/test/data/empty_list.hpp
@@ -0,0 +1,3 @@
+const auto empty_list_data = mstch::map{
+ {"jobs", mstch::array{}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/empty_list.mustache b/lib/mstch/test/data/empty_list.mustache
new file mode 100644
index 0000000..4fdf13d
--- /dev/null
+++ b/lib/mstch/test/data/empty_list.mustache
@@ -0,0 +1,4 @@
+These are the jobs:
+{{#jobs}}
+{{.}}
+{{/jobs}}
diff --git a/lib/mstch/test/data/empty_list.txt b/lib/mstch/test/data/empty_list.txt
new file mode 100644
index 0000000..d9b4a67
--- /dev/null
+++ b/lib/mstch/test/data/empty_list.txt
@@ -0,0 +1 @@
+These are the jobs:
diff --git a/lib/mstch/test/data/empty_sections.hpp b/lib/mstch/test/data/empty_sections.hpp
new file mode 100644
index 0000000..c6caee0
--- /dev/null
+++ b/lib/mstch/test/data/empty_sections.hpp
@@ -0,0 +1 @@
+const auto empty_sections_data = mstch::map{}; \ No newline at end of file
diff --git a/lib/mstch/test/data/empty_sections.mustache b/lib/mstch/test/data/empty_sections.mustache
new file mode 100644
index 0000000..b6065db
--- /dev/null
+++ b/lib/mstch/test/data/empty_sections.mustache
@@ -0,0 +1 @@
+{{#foo}}{{/foo}}foo{{#bar}}{{/bar}}
diff --git a/lib/mstch/test/data/empty_sections.txt b/lib/mstch/test/data/empty_sections.txt
new file mode 100644
index 0000000..257cc56
--- /dev/null
+++ b/lib/mstch/test/data/empty_sections.txt
@@ -0,0 +1 @@
+foo
diff --git a/lib/mstch/test/data/empty_string.hpp b/lib/mstch/test/data/empty_string.hpp
new file mode 100644
index 0000000..32e70bf
--- /dev/null
+++ b/lib/mstch/test/data/empty_string.hpp
@@ -0,0 +1,6 @@
+const auto empty_string_data = mstch::map{
+ {"description", std::string{"That is all!"}},
+ {"child", mstch::map{
+ {"description", std::string{""}}
+ }}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/empty_string.mustache b/lib/mstch/test/data/empty_string.mustache
new file mode 100644
index 0000000..f568441
--- /dev/null
+++ b/lib/mstch/test/data/empty_string.mustache
@@ -0,0 +1 @@
+{{description}}{{#child}}{{description}}{{/child}}
diff --git a/lib/mstch/test/data/empty_string.txt b/lib/mstch/test/data/empty_string.txt
new file mode 100644
index 0000000..22e2a6e
--- /dev/null
+++ b/lib/mstch/test/data/empty_string.txt
@@ -0,0 +1 @@
+That is all!
diff --git a/lib/mstch/test/data/empty_template.hpp b/lib/mstch/test/data/empty_template.hpp
new file mode 100644
index 0000000..f0208af
--- /dev/null
+++ b/lib/mstch/test/data/empty_template.hpp
@@ -0,0 +1 @@
+const auto empty_template_data = mstch::map{}; \ No newline at end of file
diff --git a/lib/mstch/test/data/empty_template.mustache b/lib/mstch/test/data/empty_template.mustache
new file mode 100644
index 0000000..bb2367a
--- /dev/null
+++ b/lib/mstch/test/data/empty_template.mustache
@@ -0,0 +1 @@
+<html><head></head><body><h1>Test</h1></body></html> \ No newline at end of file
diff --git a/lib/mstch/test/data/empty_template.txt b/lib/mstch/test/data/empty_template.txt
new file mode 100644
index 0000000..bb2367a
--- /dev/null
+++ b/lib/mstch/test/data/empty_template.txt
@@ -0,0 +1 @@
+<html><head></head><body><h1>Test</h1></body></html> \ No newline at end of file
diff --git a/lib/mstch/test/data/error_eof_in_section.hpp b/lib/mstch/test/data/error_eof_in_section.hpp
new file mode 100644
index 0000000..2e54aab
--- /dev/null
+++ b/lib/mstch/test/data/error_eof_in_section.hpp
@@ -0,0 +1,3 @@
+const auto error_eof_in_section_data = mstch::map{
+ {"hello", mstch::array{std::string{"a"}, std::string{"b"}}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/error_eof_in_section.mustache b/lib/mstch/test/data/error_eof_in_section.mustache
new file mode 100644
index 0000000..1035f91
--- /dev/null
+++ b/lib/mstch/test/data/error_eof_in_section.mustache
@@ -0,0 +1 @@
+yay{{#hello}}{{.}} \ No newline at end of file
diff --git a/lib/mstch/test/data/error_eof_in_section.txt b/lib/mstch/test/data/error_eof_in_section.txt
new file mode 100644
index 0000000..fc0e7cb
--- /dev/null
+++ b/lib/mstch/test/data/error_eof_in_section.txt
@@ -0,0 +1 @@
+yay \ No newline at end of file
diff --git a/lib/mstch/test/data/error_eof_in_tag.hpp b/lib/mstch/test/data/error_eof_in_tag.hpp
new file mode 100644
index 0000000..6f3fb1d
--- /dev/null
+++ b/lib/mstch/test/data/error_eof_in_tag.hpp
@@ -0,0 +1 @@
+const auto error_eof_in_tag_data = mstch::map{{"hello", std::string{"world"}}}; \ No newline at end of file
diff --git a/lib/mstch/test/data/error_eof_in_tag.mustache b/lib/mstch/test/data/error_eof_in_tag.mustache
new file mode 100644
index 0000000..ba4f670
--- /dev/null
+++ b/lib/mstch/test/data/error_eof_in_tag.mustache
@@ -0,0 +1 @@
+{{hello{{hello}}{{hello \ No newline at end of file
diff --git a/lib/mstch/test/data/error_eof_in_tag.txt b/lib/mstch/test/data/error_eof_in_tag.txt
new file mode 100644
index 0000000..25e277c
--- /dev/null
+++ b/lib/mstch/test/data/error_eof_in_tag.txt
@@ -0,0 +1 @@
+{{hello \ No newline at end of file
diff --git a/lib/mstch/test/data/error_not_found.hpp b/lib/mstch/test/data/error_not_found.hpp
new file mode 100644
index 0000000..c8a5420
--- /dev/null
+++ b/lib/mstch/test/data/error_not_found.hpp
@@ -0,0 +1,3 @@
+const auto error_not_found_data = mstch::map{
+ {"bar", 2}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/error_not_found.mustache b/lib/mstch/test/data/error_not_found.mustache
new file mode 100644
index 0000000..24369f7
--- /dev/null
+++ b/lib/mstch/test/data/error_not_found.mustache
@@ -0,0 +1 @@
+{{foo}} \ No newline at end of file
diff --git a/lib/mstch/test/data/error_not_found.txt b/lib/mstch/test/data/error_not_found.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/mstch/test/data/error_not_found.txt
diff --git a/lib/mstch/test/data/escaped.hpp b/lib/mstch/test/data/escaped.hpp
new file mode 100644
index 0000000..bcb21bb
--- /dev/null
+++ b/lib/mstch/test/data/escaped.hpp
@@ -0,0 +1,4 @@
+const mstch::node escaped_data = mstch::map{
+ {"title", mstch::lambda{[]()->mstch::node{ return std::string{"Bear > Shark"}; }}},
+ {"entities", mstch::lambda{[]()->mstch::node{ return std::string{"&quot; \"'<>/"}; }}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/escaped.mustache b/lib/mstch/test/data/escaped.mustache
new file mode 100644
index 0000000..93e800b
--- /dev/null
+++ b/lib/mstch/test/data/escaped.mustache
@@ -0,0 +1,2 @@
+<h1>{{title}}</h1>
+And even {{entities}}, but not {{{entities}}}.
diff --git a/lib/mstch/test/data/escaped.txt b/lib/mstch/test/data/escaped.txt
new file mode 100644
index 0000000..c1527d5
--- /dev/null
+++ b/lib/mstch/test/data/escaped.txt
@@ -0,0 +1,2 @@
+<h1>Bear &gt; Shark</h1>
+And even &amp;quot; &quot;&#39;&lt;&gt;&#x2F;, but not &quot; "'<>/.
diff --git a/lib/mstch/test/data/falsy.hpp b/lib/mstch/test/data/falsy.hpp
new file mode 100644
index 0000000..736de44
--- /dev/null
+++ b/lib/mstch/test/data/falsy.hpp
@@ -0,0 +1,6 @@
+const auto falsy_data = mstch::map{
+ {"emptyString", std::string{""}},
+ {"emptyArray", mstch::array{}},
+ {"zero", 0},
+ {"null", mstch::node{}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/falsy.mustache b/lib/mstch/test/data/falsy.mustache
new file mode 100644
index 0000000..4d992fd
--- /dev/null
+++ b/lib/mstch/test/data/falsy.mustache
@@ -0,0 +1,8 @@
+{{#emptyString}}empty string{{/emptyString}}
+{{^emptyString}}inverted empty string{{/emptyString}}
+{{#emptyArray}}empty array{{/emptyArray}}
+{{^emptyArray}}inverted empty array{{/emptyArray}}
+{{#zero}}zero{{/zero}}
+{{^zero}}inverted zero{{/zero}}
+{{#null}}null{{/null}}
+{{^null}}inverted null{{/null}}
diff --git a/lib/mstch/test/data/falsy.txt b/lib/mstch/test/data/falsy.txt
new file mode 100644
index 0000000..fde133c
--- /dev/null
+++ b/lib/mstch/test/data/falsy.txt
@@ -0,0 +1,8 @@
+
+inverted empty string
+
+inverted empty array
+
+inverted zero
+
+inverted null
diff --git a/lib/mstch/test/data/falsy_array.hpp b/lib/mstch/test/data/falsy_array.hpp
new file mode 100644
index 0000000..20a6394
--- /dev/null
+++ b/lib/mstch/test/data/falsy_array.hpp
@@ -0,0 +1,8 @@
+const auto falsy_array_data = mstch::map{
+ {"list", mstch::array{
+ mstch::array{std::string{""}, std::string{"emptyString"}},
+ mstch::array{mstch::array{}, std::string{"emptyArray"}},
+ mstch::array{0, std::string{"zero"}},
+ mstch::array{mstch::node{}, std::string{"null"}}}
+ }
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/falsy_array.mustache b/lib/mstch/test/data/falsy_array.mustache
new file mode 100644
index 0000000..2be7b37
--- /dev/null
+++ b/lib/mstch/test/data/falsy_array.mustache
@@ -0,0 +1,3 @@
+{{#list}}
+{{#.}}{{#.}}{{.}}{{/.}}{{^.}}inverted {{/.}}{{/.}}
+{{/list}} \ No newline at end of file
diff --git a/lib/mstch/test/data/falsy_array.txt b/lib/mstch/test/data/falsy_array.txt
new file mode 100644
index 0000000..a001172
--- /dev/null
+++ b/lib/mstch/test/data/falsy_array.txt
@@ -0,0 +1,4 @@
+inverted emptyString
+inverted emptyArray
+inverted zero
+inverted null
diff --git a/lib/mstch/test/data/grandparent_context.hpp b/lib/mstch/test/data/grandparent_context.hpp
new file mode 100644
index 0000000..a291143
--- /dev/null
+++ b/lib/mstch/test/data/grandparent_context.hpp
@@ -0,0 +1,19 @@
+const auto grandparent_context_data = mstch::map{
+ {"grand_parent_id", std::string{"grand_parent1"}},
+ {"parent_contexts", mstch::array{
+ mstch::map{
+ {"parent_id", std::string{"parent1"}},
+ {"child_contexts", mstch::array{
+ mstch::map{{"child_id", std::string{"parent1-child1"}}},
+ mstch::map{{"child_id", std::string{"parent1-child2"}}}
+ }}
+ },
+ mstch::map{
+ {"parent_id", std::string{"parent2"}},
+ {"child_contexts", mstch::array{
+ mstch::map{{"child_id", std::string{"parent2-child1"}}},
+ mstch::map{{"child_id", std::string{"parent2-child2"}}}
+ }}
+ }
+ }}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/grandparent_context.mustache b/lib/mstch/test/data/grandparent_context.mustache
new file mode 100644
index 0000000..e6c07a2
--- /dev/null
+++ b/lib/mstch/test/data/grandparent_context.mustache
@@ -0,0 +1,10 @@
+{{grand_parent_id}}
+{{#parent_contexts}}
+{{grand_parent_id}}
+{{parent_id}}
+{{#child_contexts}}
+{{grand_parent_id}}
+{{parent_id}}
+{{child_id}}
+{{/child_contexts}}
+{{/parent_contexts}}
diff --git a/lib/mstch/test/data/grandparent_context.txt b/lib/mstch/test/data/grandparent_context.txt
new file mode 100644
index 0000000..64996ad
--- /dev/null
+++ b/lib/mstch/test/data/grandparent_context.txt
@@ -0,0 +1,17 @@
+grand_parent1
+grand_parent1
+parent1
+grand_parent1
+parent1
+parent1-child1
+grand_parent1
+parent1
+parent1-child2
+grand_parent1
+parent2
+grand_parent1
+parent2
+parent2-child1
+grand_parent1
+parent2
+parent2-child2
diff --git a/lib/mstch/test/data/higher_order_sections.hpp b/lib/mstch/test/data/higher_order_sections.hpp
new file mode 100644
index 0000000..ef2582c
--- /dev/null
+++ b/lib/mstch/test/data/higher_order_sections.hpp
@@ -0,0 +1,28 @@
+class higher_order_sections: public mstch::object {
+ private:
+ std::string m_helper;
+ public:
+ higher_order_sections(): m_helper("To tinker?") {
+ register_methods(this, std::map<std::string,mstch::node(higher_order_sections::*)()>{
+ {"name", &higher_order_sections::name},
+ {"helper", &higher_order_sections::helper},
+ {"bolder", &higher_order_sections::bolder}
+ });
+ }
+
+ mstch::node name() {
+ return std::string{"Tater"};
+ }
+
+ mstch::node helper() {
+ return m_helper;
+ }
+
+ mstch::node bolder() {
+ return mstch::lambda{[this](const std::string& text) -> mstch::node {
+ return "<b>" + text + "</b> " + m_helper;
+ }};
+ }
+};
+
+const mstch::node higher_order_sections_data = std::make_shared<higher_order_sections>(); \ No newline at end of file
diff --git a/lib/mstch/test/data/higher_order_sections.mustache b/lib/mstch/test/data/higher_order_sections.mustache
new file mode 100644
index 0000000..04f5318
--- /dev/null
+++ b/lib/mstch/test/data/higher_order_sections.mustache
@@ -0,0 +1 @@
+{{#bolder}}Hi {{name}}.{{/bolder}}
diff --git a/lib/mstch/test/data/higher_order_sections.txt b/lib/mstch/test/data/higher_order_sections.txt
new file mode 100644
index 0000000..9db786a
--- /dev/null
+++ b/lib/mstch/test/data/higher_order_sections.txt
@@ -0,0 +1 @@
+<b>Hi Tater.</b> To tinker?
diff --git a/lib/mstch/test/data/implicit_iterator.hpp b/lib/mstch/test/data/implicit_iterator.hpp
new file mode 100644
index 0000000..a610a95
--- /dev/null
+++ b/lib/mstch/test/data/implicit_iterator.hpp
@@ -0,0 +1,8 @@
+const auto implicit_iterator_data = mstch::map{
+ {"data", mstch::map{
+ {"author", mstch::map{
+ {"twitter_id", 819606},
+ {"name", std::string{"janl"}}
+ }}
+ }}
+};
diff --git a/lib/mstch/test/data/implicit_iterator.mustache b/lib/mstch/test/data/implicit_iterator.mustache
new file mode 100644
index 0000000..ae31f34
--- /dev/null
+++ b/lib/mstch/test/data/implicit_iterator.mustache
@@ -0,0 +1,7 @@
+{{# data.author.twitter_id }}
+<meta name="twitter:site:id" content="{{.}}">
+{{/ data.author.twitter_id }}
+
+{{# data.author.name }}
+<meta name="twitter:site" content="{{.}}">
+{{/ data.author.name }}
diff --git a/lib/mstch/test/data/implicit_iterator.txt b/lib/mstch/test/data/implicit_iterator.txt
new file mode 100644
index 0000000..0fccefd
--- /dev/null
+++ b/lib/mstch/test/data/implicit_iterator.txt
@@ -0,0 +1,3 @@
+<meta name="twitter:site:id" content="819606">
+
+<meta name="twitter:site" content="janl">
diff --git a/lib/mstch/test/data/included_tag.hpp b/lib/mstch/test/data/included_tag.hpp
new file mode 100644
index 0000000..d094c3b
--- /dev/null
+++ b/lib/mstch/test/data/included_tag.hpp
@@ -0,0 +1,3 @@
+const auto included_tag_data = mstch::map{
+ {"html", std::string{"I like {{mustache}}"}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/included_tag.mustache b/lib/mstch/test/data/included_tag.mustache
new file mode 100644
index 0000000..70631c2
--- /dev/null
+++ b/lib/mstch/test/data/included_tag.mustache
@@ -0,0 +1 @@
+You said "{{{html}}}" today
diff --git a/lib/mstch/test/data/included_tag.txt b/lib/mstch/test/data/included_tag.txt
new file mode 100644
index 0000000..1af4556
--- /dev/null
+++ b/lib/mstch/test/data/included_tag.txt
@@ -0,0 +1 @@
+You said "I like {{mustache}}" today
diff --git a/lib/mstch/test/data/inverted_section.hpp b/lib/mstch/test/data/inverted_section.hpp
new file mode 100644
index 0000000..38c54c5
--- /dev/null
+++ b/lib/mstch/test/data/inverted_section.hpp
@@ -0,0 +1,3 @@
+const auto inverted_section_data = mstch::map{
+ {"repos", mstch::array{}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/inverted_section.mustache b/lib/mstch/test/data/inverted_section.mustache
new file mode 100644
index 0000000..b0a183b
--- /dev/null
+++ b/lib/mstch/test/data/inverted_section.mustache
@@ -0,0 +1,3 @@
+{{#repos}}<b>{{name}}</b>{{/repos}}
+{{^repos}}No repos :({{/repos}}
+{{^nothin}}Hello!{{/nothin}}
diff --git a/lib/mstch/test/data/inverted_section.txt b/lib/mstch/test/data/inverted_section.txt
new file mode 100644
index 0000000..b421582
--- /dev/null
+++ b/lib/mstch/test/data/inverted_section.txt
@@ -0,0 +1,3 @@
+
+No repos :(
+Hello!
diff --git a/lib/mstch/test/data/keys_with_questionmarks.hpp b/lib/mstch/test/data/keys_with_questionmarks.hpp
new file mode 100644
index 0000000..49661ca
--- /dev/null
+++ b/lib/mstch/test/data/keys_with_questionmarks.hpp
@@ -0,0 +1,5 @@
+const auto keys_with_questionmarks_data = mstch::map{
+ {"person?", mstch::map{
+ {"name", std::string{"Jon"}}
+ }}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/keys_with_questionmarks.mustache b/lib/mstch/test/data/keys_with_questionmarks.mustache
new file mode 100644
index 0000000..417f17f
--- /dev/null
+++ b/lib/mstch/test/data/keys_with_questionmarks.mustache
@@ -0,0 +1,3 @@
+{{#person?}}
+ Hi {{name}}!
+{{/person?}}
diff --git a/lib/mstch/test/data/keys_with_questionmarks.txt b/lib/mstch/test/data/keys_with_questionmarks.txt
new file mode 100644
index 0000000..0f69b94
--- /dev/null
+++ b/lib/mstch/test/data/keys_with_questionmarks.txt
@@ -0,0 +1 @@
+ Hi Jon!
diff --git a/lib/mstch/test/data/multiline_comment.hpp b/lib/mstch/test/data/multiline_comment.hpp
new file mode 100644
index 0000000..8a655f6
--- /dev/null
+++ b/lib/mstch/test/data/multiline_comment.hpp
@@ -0,0 +1 @@
+const auto multiline_comment_data = mstch::map{}; \ No newline at end of file
diff --git a/lib/mstch/test/data/multiline_comment.mustache b/lib/mstch/test/data/multiline_comment.mustache
new file mode 100644
index 0000000..dff0893
--- /dev/null
+++ b/lib/mstch/test/data/multiline_comment.mustache
@@ -0,0 +1,6 @@
+{{!
+
+This is a multi-line comment.
+
+}}
+Hello world!
diff --git a/lib/mstch/test/data/multiline_comment.txt b/lib/mstch/test/data/multiline_comment.txt
new file mode 100644
index 0000000..cd08755
--- /dev/null
+++ b/lib/mstch/test/data/multiline_comment.txt
@@ -0,0 +1 @@
+Hello world!
diff --git a/lib/mstch/test/data/nested_dot.hpp b/lib/mstch/test/data/nested_dot.hpp
new file mode 100644
index 0000000..313202f
--- /dev/null
+++ b/lib/mstch/test/data/nested_dot.hpp
@@ -0,0 +1 @@
+const auto nested_dot_data = mstch::map{{"name", std::string{"Bruno"}}}; \ No newline at end of file
diff --git a/lib/mstch/test/data/nested_dot.mustache b/lib/mstch/test/data/nested_dot.mustache
new file mode 100644
index 0000000..12b0728
--- /dev/null
+++ b/lib/mstch/test/data/nested_dot.mustache
@@ -0,0 +1 @@
+{{#name}}Hello {{.}}{{/name}} \ No newline at end of file
diff --git a/lib/mstch/test/data/nested_dot.txt b/lib/mstch/test/data/nested_dot.txt
new file mode 100644
index 0000000..58df047
--- /dev/null
+++ b/lib/mstch/test/data/nested_dot.txt
@@ -0,0 +1 @@
+Hello Bruno \ No newline at end of file
diff --git a/lib/mstch/test/data/nested_higher_order_sections.hpp b/lib/mstch/test/data/nested_higher_order_sections.hpp
new file mode 100644
index 0000000..26ed72a
--- /dev/null
+++ b/lib/mstch/test/data/nested_higher_order_sections.hpp
@@ -0,0 +1,6 @@
+const mstch::node nested_higher_order_sections_data = mstch::map{
+ {"bold", mstch::lambda{[](const std::string& text) -> mstch::node {
+ return std::string{"<b>"} + text + std::string{"</b>"};
+ }}},
+ {"person", mstch::map{{"name", std::string{"Jonas"}}}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/nested_higher_order_sections.mustache b/lib/mstch/test/data/nested_higher_order_sections.mustache
new file mode 100644
index 0000000..e312fe7
--- /dev/null
+++ b/lib/mstch/test/data/nested_higher_order_sections.mustache
@@ -0,0 +1 @@
+{{#bold}}{{#person}}My name is {{name}}!{{/person}}{{/bold}}
diff --git a/lib/mstch/test/data/nested_higher_order_sections.txt b/lib/mstch/test/data/nested_higher_order_sections.txt
new file mode 100644
index 0000000..0ee6a40
--- /dev/null
+++ b/lib/mstch/test/data/nested_higher_order_sections.txt
@@ -0,0 +1 @@
+<b>My name is Jonas!</b>
diff --git a/lib/mstch/test/data/nested_iterating.hpp b/lib/mstch/test/data/nested_iterating.hpp
new file mode 100644
index 0000000..ac2f478
--- /dev/null
+++ b/lib/mstch/test/data/nested_iterating.hpp
@@ -0,0 +1,8 @@
+const auto nested_iterating_data = mstch::map{
+ {"inner", mstch::array{mstch::map{
+ {"foo", std::string{"foo"}},
+ {"inner", mstch::array{mstch::map{
+ {"bar", std::string{"bar"}}
+ }}}
+ }}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/nested_iterating.mustache b/lib/mstch/test/data/nested_iterating.mustache
new file mode 100644
index 0000000..1a3bb1a
--- /dev/null
+++ b/lib/mstch/test/data/nested_iterating.mustache
@@ -0,0 +1 @@
+{{#inner}}{{foo}}{{#inner}}{{bar}}{{/inner}}{{/inner}}
diff --git a/lib/mstch/test/data/nested_iterating.txt b/lib/mstch/test/data/nested_iterating.txt
new file mode 100644
index 0000000..323fae0
--- /dev/null
+++ b/lib/mstch/test/data/nested_iterating.txt
@@ -0,0 +1 @@
+foobar
diff --git a/lib/mstch/test/data/nesting.hpp b/lib/mstch/test/data/nesting.hpp
new file mode 100644
index 0000000..7008030
--- /dev/null
+++ b/lib/mstch/test/data/nesting.hpp
@@ -0,0 +1,7 @@
+const auto nesting_data = mstch::map{
+ {"foo", mstch::array{
+ mstch::map{{"a", mstch::map{{"b", 1}}}},
+ mstch::map{{"a", mstch::map{{"b", 2}}}},
+ mstch::map{{"a", mstch::map{{"b", 3}}}}
+ }}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/nesting.mustache b/lib/mstch/test/data/nesting.mustache
new file mode 100644
index 0000000..551366d
--- /dev/null
+++ b/lib/mstch/test/data/nesting.mustache
@@ -0,0 +1,5 @@
+{{#foo}}
+ {{#a}}
+ {{b}}
+ {{/a}}
+{{/foo}}
diff --git a/lib/mstch/test/data/nesting.txt b/lib/mstch/test/data/nesting.txt
new file mode 100644
index 0000000..7db34b1
--- /dev/null
+++ b/lib/mstch/test/data/nesting.txt
@@ -0,0 +1,3 @@
+ 1
+ 2
+ 3
diff --git a/lib/mstch/test/data/nesting_same_name.hpp b/lib/mstch/test/data/nesting_same_name.hpp
new file mode 100644
index 0000000..c696cc9
--- /dev/null
+++ b/lib/mstch/test/data/nesting_same_name.hpp
@@ -0,0 +1,8 @@
+const auto nesting_same_name_data = mstch::map{
+ {"items", mstch::array{
+ mstch::map{
+ {"name", std::string{"name"}},
+ {"items", mstch::array{1, 2, 3, 4}}
+ }
+ }}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/nesting_same_name.mustache b/lib/mstch/test/data/nesting_same_name.mustache
new file mode 100644
index 0000000..777dbd6
--- /dev/null
+++ b/lib/mstch/test/data/nesting_same_name.mustache
@@ -0,0 +1 @@
+{{#items}}{{name}}{{#items}}{{.}}{{/items}}{{/items}}
diff --git a/lib/mstch/test/data/nesting_same_name.txt b/lib/mstch/test/data/nesting_same_name.txt
new file mode 100644
index 0000000..34fcfd3
--- /dev/null
+++ b/lib/mstch/test/data/nesting_same_name.txt
@@ -0,0 +1 @@
+name1234
diff --git a/lib/mstch/test/data/null_lookup_array.hpp b/lib/mstch/test/data/null_lookup_array.hpp
new file mode 100644
index 0000000..ea6c961
--- /dev/null
+++ b/lib/mstch/test/data/null_lookup_array.hpp
@@ -0,0 +1,8 @@
+const auto null_lookup_array_data = mstch::map{
+ {"name", std::string{"David"}},
+ {"twitter", std::string{"@dasilvacontin"}},
+ {"farray", mstch::array{
+ mstch::array{std::string{"Flor"}, std::string{"@florrts"}},
+ mstch::array{std::string{"Miquel"}, mstch::node{}},
+ }}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/null_lookup_array.mustache b/lib/mstch/test/data/null_lookup_array.mustache
new file mode 100644
index 0000000..0543895
--- /dev/null
+++ b/lib/mstch/test/data/null_lookup_array.mustache
@@ -0,0 +1,3 @@
+{{#farray}}
+{{#.}}{{#.}}{{.}} {{/.}}{{^.}}no twitter{{/.}}{{/.}}
+{{/farray}}
diff --git a/lib/mstch/test/data/null_lookup_array.txt b/lib/mstch/test/data/null_lookup_array.txt
new file mode 100644
index 0000000..d4f4dc5
--- /dev/null
+++ b/lib/mstch/test/data/null_lookup_array.txt
@@ -0,0 +1,2 @@
+Flor @florrts
+Miquel no twitter
diff --git a/lib/mstch/test/data/null_lookup_object.hpp b/lib/mstch/test/data/null_lookup_object.hpp
new file mode 100644
index 0000000..cbee5f9
--- /dev/null
+++ b/lib/mstch/test/data/null_lookup_object.hpp
@@ -0,0 +1,14 @@
+const auto null_lookup_object_data = mstch::map{
+ {"name", std::string{"David"}},
+ {"twitter", std::string{"@dasilvacontin"}},
+ {"fobject", mstch::array{
+ mstch::map{
+ {"name", std::string{"Flor"}},
+ {"twitter", std::string{"@florrts"}}
+ },
+ mstch::map{
+ {"name", std::string{"Miquel"}},
+ {"twitter", mstch::node{}}
+ }
+ }}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/null_lookup_object.mustache b/lib/mstch/test/data/null_lookup_object.mustache
new file mode 100644
index 0000000..e709ae4
--- /dev/null
+++ b/lib/mstch/test/data/null_lookup_object.mustache
@@ -0,0 +1,3 @@
+{{#fobject}}
+{{name}}'s twitter: {{#twitter}}{{.}}{{/twitter}}{{^twitter}}unknown{{/twitter}}.
+{{/fobject}}
diff --git a/lib/mstch/test/data/null_lookup_object.txt b/lib/mstch/test/data/null_lookup_object.txt
new file mode 100644
index 0000000..d1291ee
--- /dev/null
+++ b/lib/mstch/test/data/null_lookup_object.txt
@@ -0,0 +1,2 @@
+Flor's twitter: @florrts.
+Miquel's twitter: unknown.
diff --git a/lib/mstch/test/data/null_string.hpp b/lib/mstch/test/data/null_string.hpp
new file mode 100644
index 0000000..619a6f9
--- /dev/null
+++ b/lib/mstch/test/data/null_string.hpp
@@ -0,0 +1,6 @@
+const auto null_string_data = mstch::map{
+ {"name", std::string{"Elise"}},
+ {"glytch", true},
+ {"binary", false},
+ {"value", mstch::node{}}
+};
diff --git a/lib/mstch/test/data/null_string.mustache b/lib/mstch/test/data/null_string.mustache
new file mode 100644
index 0000000..d087a39
--- /dev/null
+++ b/lib/mstch/test/data/null_string.mustache
@@ -0,0 +1,4 @@
+Hello {{name}}
+glytch {{glytch}}
+binary {{binary}}
+value {{value}}
diff --git a/lib/mstch/test/data/null_string.txt b/lib/mstch/test/data/null_string.txt
new file mode 100644
index 0000000..8a0428b
--- /dev/null
+++ b/lib/mstch/test/data/null_string.txt
@@ -0,0 +1,4 @@
+Hello Elise
+glytch true
+binary false
+value
diff --git a/lib/mstch/test/data/null_view.hpp b/lib/mstch/test/data/null_view.hpp
new file mode 100644
index 0000000..a3ad5ea
--- /dev/null
+++ b/lib/mstch/test/data/null_view.hpp
@@ -0,0 +1,4 @@
+const auto null_view_data = mstch::map{
+ {"name", std::string{"Joe"}},
+ {"friends", mstch::node{}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/null_view.mustache b/lib/mstch/test/data/null_view.mustache
new file mode 100644
index 0000000..115b376
--- /dev/null
+++ b/lib/mstch/test/data/null_view.mustache
@@ -0,0 +1 @@
+{{name}}'s friends: {{#friends}}{{name}}, {{/friends}} \ No newline at end of file
diff --git a/lib/mstch/test/data/null_view.txt b/lib/mstch/test/data/null_view.txt
new file mode 100644
index 0000000..15ed2ab
--- /dev/null
+++ b/lib/mstch/test/data/null_view.txt
@@ -0,0 +1 @@
+Joe's friends: \ No newline at end of file
diff --git a/lib/mstch/test/data/partial_array.hpp b/lib/mstch/test/data/partial_array.hpp
new file mode 100644
index 0000000..a03b0e9
--- /dev/null
+++ b/lib/mstch/test/data/partial_array.hpp
@@ -0,0 +1,3 @@
+const auto partial_array_data = mstch::map{
+ {"array", mstch::array{std::string{"1"}, std::string{"2"}, std::string{"3"}, std::string{"4"}}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/partial_array.mustache b/lib/mstch/test/data/partial_array.mustache
new file mode 100644
index 0000000..7a336fe
--- /dev/null
+++ b/lib/mstch/test/data/partial_array.mustache
@@ -0,0 +1 @@
+{{>partial}} \ No newline at end of file
diff --git a/lib/mstch/test/data/partial_array.partial b/lib/mstch/test/data/partial_array.partial
new file mode 100644
index 0000000..0ba652c
--- /dev/null
+++ b/lib/mstch/test/data/partial_array.partial
@@ -0,0 +1,4 @@
+Here's a non-sense array of values
+{{#array}}
+ {{.}}
+{{/array}}
diff --git a/lib/mstch/test/data/partial_array.txt b/lib/mstch/test/data/partial_array.txt
new file mode 100644
index 0000000..892837c
--- /dev/null
+++ b/lib/mstch/test/data/partial_array.txt
@@ -0,0 +1,5 @@
+Here's a non-sense array of values
+ 1
+ 2
+ 3
+ 4
diff --git a/lib/mstch/test/data/partial_array_of_partials.hpp b/lib/mstch/test/data/partial_array_of_partials.hpp
new file mode 100644
index 0000000..2b00c5a
--- /dev/null
+++ b/lib/mstch/test/data/partial_array_of_partials.hpp
@@ -0,0 +1,8 @@
+const auto partial_array_of_partials_data = mstch::map{
+ {"numbers", mstch::array{
+ mstch::map{{"i", std::string{"1"}}},
+ mstch::map{{"i", std::string{"2"}}},
+ mstch::map{{"i", std::string{"3"}}},
+ mstch::map{{"i", std::string{"4"}}}
+ }}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/partial_array_of_partials.mustache b/lib/mstch/test/data/partial_array_of_partials.mustache
new file mode 100644
index 0000000..1af6d68
--- /dev/null
+++ b/lib/mstch/test/data/partial_array_of_partials.mustache
@@ -0,0 +1,4 @@
+Here is some stuff!
+{{#numbers}}
+{{>partial}}
+{{/numbers}}
diff --git a/lib/mstch/test/data/partial_array_of_partials.partial b/lib/mstch/test/data/partial_array_of_partials.partial
new file mode 100644
index 0000000..bdde77d
--- /dev/null
+++ b/lib/mstch/test/data/partial_array_of_partials.partial
@@ -0,0 +1 @@
+{{i}}
diff --git a/lib/mstch/test/data/partial_array_of_partials.txt b/lib/mstch/test/data/partial_array_of_partials.txt
new file mode 100644
index 0000000..f622375
--- /dev/null
+++ b/lib/mstch/test/data/partial_array_of_partials.txt
@@ -0,0 +1,5 @@
+Here is some stuff!
+1
+2
+3
+4
diff --git a/lib/mstch/test/data/partial_array_of_partials_implicit.hpp b/lib/mstch/test/data/partial_array_of_partials_implicit.hpp
new file mode 100644
index 0000000..28e3a3c
--- /dev/null
+++ b/lib/mstch/test/data/partial_array_of_partials_implicit.hpp
@@ -0,0 +1,3 @@
+const auto partial_array_of_partials_implicit_data = mstch::map{
+ {"numbers", mstch::array{std::string{"1"}, std::string{"2"}, std::string{"3"}, std::string{"4"}}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/partial_array_of_partials_implicit.mustache b/lib/mstch/test/data/partial_array_of_partials_implicit.mustache
new file mode 100644
index 0000000..1af6d68
--- /dev/null
+++ b/lib/mstch/test/data/partial_array_of_partials_implicit.mustache
@@ -0,0 +1,4 @@
+Here is some stuff!
+{{#numbers}}
+{{>partial}}
+{{/numbers}}
diff --git a/lib/mstch/test/data/partial_array_of_partials_implicit.partial b/lib/mstch/test/data/partial_array_of_partials_implicit.partial
new file mode 100644
index 0000000..12f7159
--- /dev/null
+++ b/lib/mstch/test/data/partial_array_of_partials_implicit.partial
@@ -0,0 +1 @@
+{{.}}
diff --git a/lib/mstch/test/data/partial_array_of_partials_implicit.txt b/lib/mstch/test/data/partial_array_of_partials_implicit.txt
new file mode 100644
index 0000000..f622375
--- /dev/null
+++ b/lib/mstch/test/data/partial_array_of_partials_implicit.txt
@@ -0,0 +1,5 @@
+Here is some stuff!
+1
+2
+3
+4
diff --git a/lib/mstch/test/data/partial_empty.hpp b/lib/mstch/test/data/partial_empty.hpp
new file mode 100644
index 0000000..276c972
--- /dev/null
+++ b/lib/mstch/test/data/partial_empty.hpp
@@ -0,0 +1,3 @@
+const auto partial_empty_data = mstch::map{
+ {"foo", 1}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/partial_empty.mustache b/lib/mstch/test/data/partial_empty.mustache
new file mode 100644
index 0000000..a710047
--- /dev/null
+++ b/lib/mstch/test/data/partial_empty.mustache
@@ -0,0 +1,2 @@
+hey {{foo}}
+{{>partial}}
diff --git a/lib/mstch/test/data/partial_empty.partial b/lib/mstch/test/data/partial_empty.partial
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/mstch/test/data/partial_empty.partial
diff --git a/lib/mstch/test/data/partial_empty.txt b/lib/mstch/test/data/partial_empty.txt
new file mode 100644
index 0000000..1a67907
--- /dev/null
+++ b/lib/mstch/test/data/partial_empty.txt
@@ -0,0 +1 @@
+hey 1
diff --git a/lib/mstch/test/data/partial_template.hpp b/lib/mstch/test/data/partial_template.hpp
new file mode 100644
index 0000000..88c659b
--- /dev/null
+++ b/lib/mstch/test/data/partial_template.hpp
@@ -0,0 +1,4 @@
+const mstch::node partial_template_data = mstch::map{
+ {"title", mstch::lambda{[]()->mstch::node{ return std::string{"Welcome"}; }}},
+ {"again", mstch::lambda{[]()->mstch::node{ return std::string{"Goodbye"}; }}},
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/partial_template.mustache b/lib/mstch/test/data/partial_template.mustache
new file mode 100644
index 0000000..6a7492e
--- /dev/null
+++ b/lib/mstch/test/data/partial_template.mustache
@@ -0,0 +1,2 @@
+<h1>{{title}}</h1>
+{{>partial}}
diff --git a/lib/mstch/test/data/partial_template.partial b/lib/mstch/test/data/partial_template.partial
new file mode 100644
index 0000000..a404529
--- /dev/null
+++ b/lib/mstch/test/data/partial_template.partial
@@ -0,0 +1 @@
+Again, {{again}}!
diff --git a/lib/mstch/test/data/partial_template.txt b/lib/mstch/test/data/partial_template.txt
new file mode 100644
index 0000000..692698f
--- /dev/null
+++ b/lib/mstch/test/data/partial_template.txt
@@ -0,0 +1,2 @@
+<h1>Welcome</h1>
+Again, Goodbye!
diff --git a/lib/mstch/test/data/partial_view.hpp b/lib/mstch/test/data/partial_view.hpp
new file mode 100644
index 0000000..5c2c3eb
--- /dev/null
+++ b/lib/mstch/test/data/partial_view.hpp
@@ -0,0 +1,42 @@
+class partial_view: public mstch::object {
+private:
+ int m_value;
+
+public:
+ partial_view(): m_value(10000) {
+ register_methods(this, std::map<std::string,mstch::node(partial_view::*)()>{
+ {"greeting", &partial_view::greeting},
+ {"farewell", &partial_view::farewell},
+ {"name", &partial_view::name},
+ {"value", &partial_view::value},
+ {"taxed_value", &partial_view::taxed_value},
+ {"in_ca", &partial_view::in_ca}
+ });
+ }
+
+ mstch::node greeting() {
+ return std::string{"Welcome"};
+ }
+
+ mstch::node farewell() {
+ return std::string{"Fair enough, right?"};
+ }
+
+ mstch::node name() {
+ return std::string{"Chris"};
+ }
+
+ mstch::node value() {
+ return m_value;
+ }
+
+ mstch::node taxed_value() {
+ return m_value - (m_value * 0.4);
+ }
+
+ mstch::node in_ca() {
+ return true;
+ }
+};
+
+const auto partial_view_data = std::make_shared<partial_view>(); \ No newline at end of file
diff --git a/lib/mstch/test/data/partial_view.mustache b/lib/mstch/test/data/partial_view.mustache
new file mode 100644
index 0000000..f8f6a5b
--- /dev/null
+++ b/lib/mstch/test/data/partial_view.mustache
@@ -0,0 +1,3 @@
+<h1>{{greeting}}</h1>
+{{>partial}}
+<h3>{{farewell}}</h3>
diff --git a/lib/mstch/test/data/partial_view.partial b/lib/mstch/test/data/partial_view.partial
new file mode 100644
index 0000000..03df206
--- /dev/null
+++ b/lib/mstch/test/data/partial_view.partial
@@ -0,0 +1,5 @@
+Hello {{name}}
+You have just won ${{value}}!
+{{#in_ca}}
+Well, ${{ taxed_value }}, after taxes.
+{{/in_ca}} \ No newline at end of file
diff --git a/lib/mstch/test/data/partial_view.txt b/lib/mstch/test/data/partial_view.txt
new file mode 100644
index 0000000..c09147c
--- /dev/null
+++ b/lib/mstch/test/data/partial_view.txt
@@ -0,0 +1,5 @@
+<h1>Welcome</h1>
+Hello Chris
+You have just won $10000!
+Well, $6000, after taxes.
+<h3>Fair enough, right?</h3>
diff --git a/lib/mstch/test/data/partial_whitespace.hpp b/lib/mstch/test/data/partial_whitespace.hpp
new file mode 100644
index 0000000..85fa5dc
--- /dev/null
+++ b/lib/mstch/test/data/partial_whitespace.hpp
@@ -0,0 +1,41 @@
+class partial_whitespace: public mstch::object {
+private:
+ int m_value;
+public:
+ partial_whitespace(): m_value(10000) {
+ register_methods(this, std::map<std::string,mstch::node(partial_whitespace::*)()>{
+ {"greeting", &partial_whitespace::greeting},
+ {"farewell", &partial_whitespace::farewell},
+ {"name", &partial_whitespace::name},
+ {"value", &partial_whitespace::value},
+ {"taxed_value", &partial_whitespace::taxed_value},
+ {"in_ca", &partial_whitespace::in_ca}
+ });
+ }
+
+ mstch::node greeting() {
+ return std::string{"Welcome"};
+ }
+
+ mstch::node farewell() {
+ return std::string{"Fair enough, right?"};
+ }
+
+ mstch::node name() {
+ return std::string{"Chris"};
+ }
+
+ mstch::node value() {
+ return m_value;
+ }
+
+ mstch::node taxed_value() {
+ return static_cast<int>(m_value - (m_value * 0.4));
+ }
+
+ mstch::node in_ca() {
+ return true;
+ }
+};
+
+const auto partial_whitespace_data = std::make_shared<partial_whitespace>(); \ No newline at end of file
diff --git a/lib/mstch/test/data/partial_whitespace.mustache b/lib/mstch/test/data/partial_whitespace.mustache
new file mode 100644
index 0000000..48bd1ff
--- /dev/null
+++ b/lib/mstch/test/data/partial_whitespace.mustache
@@ -0,0 +1,3 @@
+<h1>{{ greeting }}</h1>
+{{> partial }}
+<h3>{{ farewell }}</h3>
diff --git a/lib/mstch/test/data/partial_whitespace.partial b/lib/mstch/test/data/partial_whitespace.partial
new file mode 100644
index 0000000..30de8f6
--- /dev/null
+++ b/lib/mstch/test/data/partial_whitespace.partial
@@ -0,0 +1,5 @@
+Hello {{ name}}
+You have just won ${{value }}!
+{{# in_ca }}
+Well, ${{ taxed_value }}, after taxes.
+{{/ in_ca }} \ No newline at end of file
diff --git a/lib/mstch/test/data/partial_whitespace.txt b/lib/mstch/test/data/partial_whitespace.txt
new file mode 100644
index 0000000..c09147c
--- /dev/null
+++ b/lib/mstch/test/data/partial_whitespace.txt
@@ -0,0 +1,5 @@
+<h1>Welcome</h1>
+Hello Chris
+You have just won $10000!
+Well, $6000, after taxes.
+<h3>Fair enough, right?</h3>
diff --git a/lib/mstch/test/data/recursion_with_same_names.hpp b/lib/mstch/test/data/recursion_with_same_names.hpp
new file mode 100644
index 0000000..a9170db
--- /dev/null
+++ b/lib/mstch/test/data/recursion_with_same_names.hpp
@@ -0,0 +1,8 @@
+const auto recursion_with_same_names_data = mstch::map{
+ {"name", std::string{"name"}},
+ {"description", std::string{"desc"}},
+ {"terms", mstch::array{
+ mstch::map{{"name", std::string{"t1"}}, {"index", 0}},
+ mstch::map{{"name", std::string{"t2"}}, {"index", 1}}
+ }}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/recursion_with_same_names.mustache b/lib/mstch/test/data/recursion_with_same_names.mustache
new file mode 100644
index 0000000..c331d04
--- /dev/null
+++ b/lib/mstch/test/data/recursion_with_same_names.mustache
@@ -0,0 +1,7 @@
+{{ name }}
+{{ description }}
+
+{{#terms}}
+ {{name}}
+ {{index}}
+{{/terms}}
diff --git a/lib/mstch/test/data/recursion_with_same_names.txt b/lib/mstch/test/data/recursion_with_same_names.txt
new file mode 100644
index 0000000..cb15d75
--- /dev/null
+++ b/lib/mstch/test/data/recursion_with_same_names.txt
@@ -0,0 +1,7 @@
+name
+desc
+
+ t1
+ 0
+ t2
+ 1
diff --git a/lib/mstch/test/data/reuse_of_enumerables.hpp b/lib/mstch/test/data/reuse_of_enumerables.hpp
new file mode 100644
index 0000000..88c1c8e
--- /dev/null
+++ b/lib/mstch/test/data/reuse_of_enumerables.hpp
@@ -0,0 +1,6 @@
+const auto reuse_of_enumerables_data = mstch::map{
+ {"terms", mstch::array{
+ mstch::map{{"name", std::string{"t1"}}, {"index", 0}},
+ mstch::map{{"name", std::string{"t2"}}, {"index", 1}}
+ }}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/reuse_of_enumerables.mustache b/lib/mstch/test/data/reuse_of_enumerables.mustache
new file mode 100644
index 0000000..cc0cb7a
--- /dev/null
+++ b/lib/mstch/test/data/reuse_of_enumerables.mustache
@@ -0,0 +1,8 @@
+{{#terms}}
+ {{name}}
+ {{index}}
+{{/terms}}
+{{#terms}}
+ {{name}}
+ {{index}}
+{{/terms}}
diff --git a/lib/mstch/test/data/reuse_of_enumerables.txt b/lib/mstch/test/data/reuse_of_enumerables.txt
new file mode 100644
index 0000000..6d05d96
--- /dev/null
+++ b/lib/mstch/test/data/reuse_of_enumerables.txt
@@ -0,0 +1,8 @@
+ t1
+ 0
+ t2
+ 1
+ t1
+ 0
+ t2
+ 1
diff --git a/lib/mstch/test/data/section_as_context.hpp b/lib/mstch/test/data/section_as_context.hpp
new file mode 100644
index 0000000..fc5333a
--- /dev/null
+++ b/lib/mstch/test/data/section_as_context.hpp
@@ -0,0 +1,10 @@
+const auto section_as_context_data = mstch::map{
+ {"a_object", mstch::map{
+ {"title", std::string{"this is an object"}},
+ {"description", std::string{"one of its attributes is a list"}},
+ {"a_list", mstch::array{
+ mstch::map{{"label", std::string{"listitem1"}}},
+ mstch::map{{"label", std::string{"listitem2"}}}
+ }}
+ }}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/section_as_context.mustache b/lib/mstch/test/data/section_as_context.mustache
new file mode 100644
index 0000000..59990f6
--- /dev/null
+++ b/lib/mstch/test/data/section_as_context.mustache
@@ -0,0 +1,9 @@
+{{#a_object}}
+ <h1>{{title}}</h1>
+ <p>{{description}}</p>
+ <ul>
+ {{#a_list}}
+ <li>{{label}}</li>
+ {{/a_list}}
+ </ul>
+{{/a_object}}
diff --git a/lib/mstch/test/data/section_as_context.txt b/lib/mstch/test/data/section_as_context.txt
new file mode 100644
index 0000000..d834e80
--- /dev/null
+++ b/lib/mstch/test/data/section_as_context.txt
@@ -0,0 +1,6 @@
+ <h1>this is an object</h1>
+ <p>one of its attributes is a list</p>
+ <ul>
+ <li>listitem1</li>
+ <li>listitem2</li>
+ </ul>
diff --git a/lib/mstch/test/data/section_functions_in_partials.hpp b/lib/mstch/test/data/section_functions_in_partials.hpp
new file mode 100644
index 0000000..1fc4434
--- /dev/null
+++ b/lib/mstch/test/data/section_functions_in_partials.hpp
@@ -0,0 +1,5 @@
+const mstch::node section_functions_in_partials_data = mstch::map{
+ {"bold", mstch::lambda{[](const std::string& text) -> mstch::node {
+ return std::string{"<b>"} + text + std::string{"</b>"};
+ }}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/section_functions_in_partials.mustache b/lib/mstch/test/data/section_functions_in_partials.mustache
new file mode 100644
index 0000000..8164932
--- /dev/null
+++ b/lib/mstch/test/data/section_functions_in_partials.mustache
@@ -0,0 +1,3 @@
+{{> partial}}
+
+<p>some more text</p>
diff --git a/lib/mstch/test/data/section_functions_in_partials.partial b/lib/mstch/test/data/section_functions_in_partials.partial
new file mode 100644
index 0000000..3e90b00
--- /dev/null
+++ b/lib/mstch/test/data/section_functions_in_partials.partial
@@ -0,0 +1 @@
+{{#bold}}Hello There{{/bold}}
diff --git a/lib/mstch/test/data/section_functions_in_partials.txt b/lib/mstch/test/data/section_functions_in_partials.txt
new file mode 100644
index 0000000..2f5955c
--- /dev/null
+++ b/lib/mstch/test/data/section_functions_in_partials.txt
@@ -0,0 +1,3 @@
+<b>Hello There</b>
+
+<p>some more text</p>
diff --git a/lib/mstch/test/data/simple.hpp b/lib/mstch/test/data/simple.hpp
new file mode 100644
index 0000000..254a6d3
--- /dev/null
+++ b/lib/mstch/test/data/simple.hpp
@@ -0,0 +1,32 @@
+class simple: public mstch::object {
+private:
+ int m_value;
+public:
+ simple():
+ m_value(10000)
+ {
+ register_methods(this, std::map<std::string,mstch::node(simple::*)()>{
+ {"name", &simple::name},
+ {"value", &simple::value},
+ {"taxed_value", &simple::taxed_value},
+ {"in_ca", &simple::in_ca}});
+ }
+
+ mstch::node name() {
+ return std::string{"Chris"};
+ }
+
+ mstch::node value() {
+ return m_value;
+ }
+
+ mstch::node taxed_value() {
+ return m_value - (m_value * 0.4);
+ }
+
+ mstch::node in_ca() {
+ return true;
+ }
+};
+
+const auto simple_data = std::make_shared<simple>(); \ No newline at end of file
diff --git a/lib/mstch/test/data/simple.mustache b/lib/mstch/test/data/simple.mustache
new file mode 100644
index 0000000..2fea632
--- /dev/null
+++ b/lib/mstch/test/data/simple.mustache
@@ -0,0 +1,5 @@
+Hello {{name}}
+You have just won ${{value}}!
+{{#in_ca}}
+Well, ${{ taxed_value }}, after taxes.
+{{/in_ca}}
diff --git a/lib/mstch/test/data/simple.txt b/lib/mstch/test/data/simple.txt
new file mode 100644
index 0000000..5d75d65
--- /dev/null
+++ b/lib/mstch/test/data/simple.txt
@@ -0,0 +1,3 @@
+Hello Chris
+You have just won $10000!
+Well, $6000, after taxes.
diff --git a/lib/mstch/test/data/string_as_context.hpp b/lib/mstch/test/data/string_as_context.hpp
new file mode 100644
index 0000000..56ee3a1
--- /dev/null
+++ b/lib/mstch/test/data/string_as_context.hpp
@@ -0,0 +1,4 @@
+const auto string_as_context_data = mstch::map{
+ {"a_string", std::string{"aa"}},
+ {"a_list", mstch::array{std::string{"a"},std::string{"b"},std::string{"c"}}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/string_as_context.mustache b/lib/mstch/test/data/string_as_context.mustache
new file mode 100644
index 0000000..00f7181
--- /dev/null
+++ b/lib/mstch/test/data/string_as_context.mustache
@@ -0,0 +1,5 @@
+<ul>
+{{#a_list}}
+ <li>{{a_string}}/{{.}}</li>
+{{/a_list}}
+</ul> \ No newline at end of file
diff --git a/lib/mstch/test/data/string_as_context.txt b/lib/mstch/test/data/string_as_context.txt
new file mode 100644
index 0000000..8bd87ff
--- /dev/null
+++ b/lib/mstch/test/data/string_as_context.txt
@@ -0,0 +1,5 @@
+<ul>
+ <li>aa/a</li>
+ <li>aa/b</li>
+ <li>aa/c</li>
+</ul> \ No newline at end of file
diff --git a/lib/mstch/test/data/two_in_a_row.hpp b/lib/mstch/test/data/two_in_a_row.hpp
new file mode 100644
index 0000000..496ef8f
--- /dev/null
+++ b/lib/mstch/test/data/two_in_a_row.hpp
@@ -0,0 +1,4 @@
+const auto two_in_a_row_data = mstch::map{
+ {"name", std::string{"Joe"}},
+ {"greeting", std::string{"Welcome"}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/two_in_a_row.mustache b/lib/mstch/test/data/two_in_a_row.mustache
new file mode 100644
index 0000000..b23f29e
--- /dev/null
+++ b/lib/mstch/test/data/two_in_a_row.mustache
@@ -0,0 +1 @@
+{{greeting}}, {{name}}!
diff --git a/lib/mstch/test/data/two_in_a_row.txt b/lib/mstch/test/data/two_in_a_row.txt
new file mode 100644
index 0000000..c6d6a9b
--- /dev/null
+++ b/lib/mstch/test/data/two_in_a_row.txt
@@ -0,0 +1 @@
+Welcome, Joe!
diff --git a/lib/mstch/test/data/two_sections.hpp b/lib/mstch/test/data/two_sections.hpp
new file mode 100644
index 0000000..16f0cc0
--- /dev/null
+++ b/lib/mstch/test/data/two_sections.hpp
@@ -0,0 +1 @@
+const auto two_sections_data = mstch::map{}; \ No newline at end of file
diff --git a/lib/mstch/test/data/two_sections.mustache b/lib/mstch/test/data/two_sections.mustache
new file mode 100644
index 0000000..a4b9f2a
--- /dev/null
+++ b/lib/mstch/test/data/two_sections.mustache
@@ -0,0 +1,4 @@
+{{#foo}}
+{{/foo}}
+{{#bar}}
+{{/bar}}
diff --git a/lib/mstch/test/data/two_sections.txt b/lib/mstch/test/data/two_sections.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/mstch/test/data/two_sections.txt
diff --git a/lib/mstch/test/data/unescaped.hpp b/lib/mstch/test/data/unescaped.hpp
new file mode 100644
index 0000000..66914a9
--- /dev/null
+++ b/lib/mstch/test/data/unescaped.hpp
@@ -0,0 +1,3 @@
+const mstch::node unescaped_data = mstch::map{
+ {"title", mstch::lambda{[]()->mstch::node{ return std::string{"Bear > Shark"}; }}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/unescaped.mustache b/lib/mstch/test/data/unescaped.mustache
new file mode 100644
index 0000000..6b07d7b
--- /dev/null
+++ b/lib/mstch/test/data/unescaped.mustache
@@ -0,0 +1 @@
+<h1>{{{title}}}</h1>
diff --git a/lib/mstch/test/data/unescaped.txt b/lib/mstch/test/data/unescaped.txt
new file mode 100644
index 0000000..089ad79
--- /dev/null
+++ b/lib/mstch/test/data/unescaped.txt
@@ -0,0 +1 @@
+<h1>Bear > Shark</h1>
diff --git a/lib/mstch/test/data/whitespace.hpp b/lib/mstch/test/data/whitespace.hpp
new file mode 100644
index 0000000..9fa087f
--- /dev/null
+++ b/lib/mstch/test/data/whitespace.hpp
@@ -0,0 +1,4 @@
+const auto whitespace_data = mstch::map{
+ {"tag1", std::string{"Hello"}},
+ {"tag2", std::string{"World"}}
+}; \ No newline at end of file
diff --git a/lib/mstch/test/data/whitespace.mustache b/lib/mstch/test/data/whitespace.mustache
new file mode 100644
index 0000000..aa76e08
--- /dev/null
+++ b/lib/mstch/test/data/whitespace.mustache
@@ -0,0 +1,4 @@
+{{tag1}}
+
+
+{{tag2}}.
diff --git a/lib/mstch/test/data/whitespace.txt b/lib/mstch/test/data/whitespace.txt
new file mode 100644
index 0000000..851fa74
--- /dev/null
+++ b/lib/mstch/test/data/whitespace.txt
@@ -0,0 +1,4 @@
+Hello
+
+
+World.
diff --git a/lib/mstch/test/data/zero_view.hpp b/lib/mstch/test/data/zero_view.hpp
new file mode 100644
index 0000000..f6006b3
--- /dev/null
+++ b/lib/mstch/test/data/zero_view.hpp
@@ -0,0 +1 @@
+const auto zero_view_data = mstch::map{{"nums", mstch::array{0, 1, 2}}}; \ No newline at end of file
diff --git a/lib/mstch/test/data/zero_view.mustache b/lib/mstch/test/data/zero_view.mustache
new file mode 100644
index 0000000..1cdc190
--- /dev/null
+++ b/lib/mstch/test/data/zero_view.mustache
@@ -0,0 +1 @@
+{{#nums}}{{.}},{{/nums}} \ No newline at end of file
diff --git a/lib/mstch/test/data/zero_view.txt b/lib/mstch/test/data/zero_view.txt
new file mode 100644
index 0000000..2aee585
--- /dev/null
+++ b/lib/mstch/test/data/zero_view.txt
@@ -0,0 +1 @@
+0,1,2, \ No newline at end of file