diff --git a/test/data/complex.hpp b/test/data/complex.hpp index 481580d..36926a8 100644 --- a/test/data/complex.hpp +++ b/test/data/complex.hpp @@ -45,8 +45,7 @@ public: { register_methods(this, { {"header", &complex::header}, {"item", &complex::item}, - {"list", &complex::list}, {"empty", &complex::empty} - }); + {"list", &complex::list}, {"empty", &complex::empty}}); } mstch::node header() { diff --git a/test/data/lambda/null_string.js b/test/data/lambda/null_string.js deleted file mode 100644 index 984ee51..0000000 --- a/test/data/lambda/null_string.js +++ /dev/null @@ -1,10 +0,0 @@ -({ - name: "Elise", - glytch: true, - binary: false, - value: null, - undef: undefined, - numeric: function() { - return NaN; - } -}) diff --git a/test/data/lambda/partial_view.js b/test/data/lambda/partial_view.js deleted file mode 100644 index 3ad70d3..0000000 --- a/test/data/lambda/partial_view.js +++ /dev/null @@ -1,14 +0,0 @@ -({ - greeting: function () { - return "Welcome"; - }, - farewell: function () { - return "Fair enough, right?"; - }, - name: "Chris", - value: 10000, - taxed_value: function () { - return this.value - (this.value * 0.4); - }, - in_ca: true -}) diff --git a/test/data/lambda/partial_whitespace.js b/test/data/lambda/partial_whitespace.js deleted file mode 100644 index 3ad70d3..0000000 --- a/test/data/lambda/partial_whitespace.js +++ /dev/null @@ -1,14 +0,0 @@ -({ - greeting: function () { - return "Welcome"; - }, - farewell: function () { - return "Fair enough, right?"; - }, - name: "Chris", - value: 10000, - taxed_value: function () { - return this.value - (this.value * 0.4); - }, - in_ca: true -}) diff --git a/test/data/lambda/simple.js b/test/data/lambda/simple.js deleted file mode 100644 index 1d8d6f4..0000000 --- a/test/data/lambda/simple.js +++ /dev/null @@ -1,8 +0,0 @@ -({ - name: "Chris", - value: 10000, - taxed_value: function () { - return this.value - (this.value * 0.4); - }, - in_ca: true -}) diff --git a/test/data/null_string.hpp b/test/data/null_string.hpp new file mode 100644 index 0000000..619a6f9 --- /dev/null +++ b/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/test/data/lambda/null_string.mustache b/test/data/null_string.mustache similarity index 65% rename from test/data/lambda/null_string.mustache rename to test/data/null_string.mustache index a6f3300..d087a39 100644 --- a/test/data/lambda/null_string.mustache +++ b/test/data/null_string.mustache @@ -2,5 +2,3 @@ Hello {{name}} glytch {{glytch}} binary {{binary}} value {{value}} -undef {{undef}} -numeric {{numeric}} diff --git a/test/data/lambda/null_string.txt b/test/data/null_string.txt similarity index 69% rename from test/data/lambda/null_string.txt rename to test/data/null_string.txt index bcabe0a..8a0428b 100644 --- a/test/data/lambda/null_string.txt +++ b/test/data/null_string.txt @@ -2,5 +2,3 @@ Hello Elise glytch true binary false value -undef -numeric NaN diff --git a/test/data/partial_view.hpp b/test/data/partial_view.hpp new file mode 100644 index 0000000..fa6d7db --- /dev/null +++ b/test/data/partial_view.hpp @@ -0,0 +1,40 @@ +class partial_view: public mstch::object { +private: + int m_value; +public: + partial_view(): m_value{10000} { + register_methods(this, { + {"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 static_cast(m_value - (m_value * 0.4)); + } + + mstch::node in_ca() { + return true; + } +}; + +const auto partial_view_data = std::make_shared(); \ No newline at end of file diff --git a/test/data/lambda/partial_view.mustache b/test/data/partial_view.mustache similarity index 100% rename from test/data/lambda/partial_view.mustache rename to test/data/partial_view.mustache diff --git a/test/data/lambda/partial_view.partial b/test/data/partial_view.partial similarity index 100% rename from test/data/lambda/partial_view.partial rename to test/data/partial_view.partial diff --git a/test/data/lambda/partial_view.txt b/test/data/partial_view.txt similarity index 100% rename from test/data/lambda/partial_view.txt rename to test/data/partial_view.txt diff --git a/test/data/partial_whitespace.hpp b/test/data/partial_whitespace.hpp new file mode 100644 index 0000000..a63a20c --- /dev/null +++ b/test/data/partial_whitespace.hpp @@ -0,0 +1,40 @@ +class partial_whitespace: public mstch::object { +private: + int m_value; +public: + partial_whitespace(): m_value{10000} { + register_methods(this, { + {"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(m_value - (m_value * 0.4)); + } + + mstch::node in_ca() { + return true; + } +}; + +const auto partial_whitespace_data = std::make_shared(); \ No newline at end of file diff --git a/test/data/lambda/partial_whitespace.mustache b/test/data/partial_whitespace.mustache similarity index 100% rename from test/data/lambda/partial_whitespace.mustache rename to test/data/partial_whitespace.mustache diff --git a/test/data/lambda/partial_whitespace.partial b/test/data/partial_whitespace.partial similarity index 100% rename from test/data/lambda/partial_whitespace.partial rename to test/data/partial_whitespace.partial diff --git a/test/data/lambda/partial_whitespace.txt b/test/data/partial_whitespace.txt similarity index 100% rename from test/data/lambda/partial_whitespace.txt rename to test/data/partial_whitespace.txt diff --git a/test/data/simple.hpp b/test/data/simple.hpp new file mode 100644 index 0000000..5800732 --- /dev/null +++ b/test/data/simple.hpp @@ -0,0 +1,34 @@ +class simple: public mstch::object { +private: + std::string m_name; + int m_value; + bool m_in_ca; +public: + simple(): + m_name{"Chris"}, + m_value{10000}, + m_in_ca{true} + { + register_methods(this, { + {"name", &simple::name}, {"value", &simple::value}, + {"taxed_value", &simple::taxed_value}, {"in_ca", &simple::in_ca}}); + } + + mstch::node name() { + return m_name; + } + + mstch::node value() { + return m_value; + } + + mstch::node taxed_value() { + return static_cast(m_value - (m_value * 0.4)); + } + + mstch::node in_ca() { + return m_in_ca; + } +}; + +const auto simple_data = std::make_shared(); diff --git a/test/data/lambda/simple.mustache b/test/data/simple.mustache similarity index 100% rename from test/data/lambda/simple.mustache rename to test/data/simple.mustache diff --git a/test/data/lambda/simple.txt b/test/data/simple.txt similarity index 100% rename from test/data/lambda/simple.txt rename to test/data/simple.txt diff --git a/test/test_main.cpp b/test/test_main.cpp index 321e393..4ded83e 100644 --- a/test/test_main.cpp +++ b/test/test_main.cpp @@ -47,16 +47,20 @@ MSTCH_TEST(nesting) MSTCH_TEST(nesting_same_name) MSTCH_TEST(null_lookup_array) MSTCH_TEST(null_lookup_object) +MSTCH_TEST(null_string) MSTCH_TEST(null_view) MSTCH_PARTIAL_TEST(partial_array) MSTCH_PARTIAL_TEST(partial_array_of_partials) MSTCH_PARTIAL_TEST(partial_array_of_partials_implicit) MSTCH_PARTIAL_TEST(partial_empty) MSTCH_PARTIAL_TEST(partial_template) +MSTCH_PARTIAL_TEST(partial_view) +MSTCH_PARTIAL_TEST(partial_whitespace) MSTCH_TEST(recursion_with_same_names) MSTCH_TEST(reuse_of_enumerables) MSTCH_TEST(section_as_context) //MSTCH_PARTIAL_TEST(section_functions_in_partials) +MSTCH_TEST(simple) MSTCH_TEST(string_as_context) MSTCH_TEST(two_in_a_row) MSTCH_TEST(two_sections)