]> Devi Nivas Git - chevron.git/commitdiff
Moved test files to tests/
authornoah morrison <noah@morrison.ph>
Mon, 17 Nov 2014 20:13:55 +0000 (15:13 -0500)
committernoah morrison <noah@morrison.ph>
Mon, 17 Nov 2014 20:13:55 +0000 (15:13 -0500)
data.json [deleted file]
entei.py
partial.mustache [deleted file]
test.mustache [deleted file]
test.rendered [deleted file]
test_spec.py
tests/data.json [new file with mode: 0644]
tests/partial.mustache [new file with mode: 0644]
tests/test.mustache [new file with mode: 0644]
tests/test.rendered [new file with mode: 0644]

diff --git a/data.json b/data.json
deleted file mode 100644 (file)
index dbcb0c6..0000000
--- a/data.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "test": "test",
-  "html_escaped": "< > & \"",
-  "true": true,
-  "false": false,
-  "list": [
-      {"i": 1, "v": "one"},
-      {"i": 2, "v": "two"},
-      {"i": 3, "v": "three"}
-  ],
-
-  "scope": {
-      "test": "new test"
-  }
-}
index 7dd92a68591abe38fd724f617364d00ce7600321..a19e03f17ffc26bef1057ddbd04eb22468808b27 100755 (executable)
--- a/entei.py
+++ b/entei.py
@@ -360,7 +360,7 @@ def render(template='', data={}, partials_path='.', partials_ext='mustache',
 
     return output
 
-def main(data, template):
+def main(data, template, **kwargs):
     data = data
     template = template
 
@@ -371,6 +371,7 @@ def main(data, template):
                 'data': json.load(data_file)
             }
 
+            args.update(kwargs)
             return render(**args)
 
 if __name__ == '__main__':
diff --git a/partial.mustache b/partial.mustache
deleted file mode 100644 (file)
index 55bd722..0000000
+++ /dev/null
@@ -1 +0,0 @@
-this is a partial{{excited}}
diff --git a/test.mustache b/test.mustache
deleted file mode 100644 (file)
index 0597412..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-{{!
-    mustache comment!
-}}
-
-variable test
-===
-{{ test }}
-===
-test
-===
-
-comment test
-===
-{{!
-    mustache comment
-}}
-===
-===
-
-html escape test (triple brackets)
-===
-{{{html_escaped}}}
-===
-< > & "
-===
-
-html escape test (ampersand)
-===
-{{& html_escaped}}
-===
-< > & "
-===
-
-html escape test (normal)
-===
-{{ html_escaped }}
-===
-&lt; &gt; &amp; &quot;
-===
-
-section test (truthy)
-===
-{{# true }}
-true
-{{/ true }}
-===
-true
-===
-
-section test (falsy)
-===
-{{# false }}
-ERROR
-{{/ false }}
-===
-===
-
-section test (list)
-===
-{{# list }}
-number: {{i}}
-name: {{v}}
----
-{{/ list }}
-===
-number: 1
-name: one
----
-number: 2
-name: two
----
-number: 3
-name: three
----
-===
-
-section test (scope)
-===
-{{ test }}
-{{# scope }}
-{{ test }}
-{{/ scope }}
-===
-test
-new test
-===
-
-inverted section test (truthy)
-===
-{{^ true }}
-ERROR
-{{/ true }}
-===
-===
-
-inverted section test (falsy)
-===
-{{^ false }}
-false
-{{/ false }}
-===
-false
-===
-
-partial test
-===
-{{> partial}}
-===
-this is a partial
-===
-
-delimiter test
-===
-{{=(( ))=}}
-(( test ))
-((={{ }}=))
-{{ test }}
-===
-test
-test
-===
diff --git a/test.rendered b/test.rendered
deleted file mode 100644 (file)
index 437acdf..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-
-variable test
-===
-test
-===
-test
-===
-
-comment test
-===
-===
-===
-
-html escape test (triple brackets)
-===
-< > & "
-===
-< > & "
-===
-
-html escape test (ampersand)
-===
-< > & "
-===
-< > & "
-===
-
-html escape test (normal)
-===
-&lt; &gt; &amp; &quot;
-===
-&lt; &gt; &amp; &quot;
-===
-
-section test (truthy)
-===
-true
-===
-true
-===
-
-section test (falsy)
-===
-===
-===
-
-section test (list)
-===
-number: 1
-name: one
----
-number: 2
-name: two
----
-number: 3
-name: three
----
-===
-number: 1
-name: one
----
-number: 2
-name: two
----
-number: 3
-name: three
----
-===
-
-section test (scope)
-===
-test
-new test
-===
-test
-new test
-===
-
-inverted section test (truthy)
-===
-===
-===
-
-inverted section test (falsy)
-===
-false
-===
-false
-===
-
-partial test
-===
-this is a partial
-===
-this is a partial
-===
-
-delimiter test
-===
-test
-test
-===
-test
-test
-===
index 1d37a403cb0f5d617cb3f129eb0d24f07e52210d..5b7697946f2e55a741107cfd430a9ba30f6880c0 100755 (executable)
@@ -62,8 +62,8 @@ class ExpandedCoverage(unittest.TestCase):
         self.assertRaises(entei.UnclosedSection, entei.render, **test2)
 
     def test_main(self):
-        result = entei.main('data.json', 'test.mustache')
-        with open('test.rendered', 'r') as f:
+        result = entei.main('tests/data.json', 'tests/test.mustache', partials_path='tests')
+        with open('tests/test.rendered', 'r') as f:
             expected = f.read()
 
         self.assertEqual(result, expected)
diff --git a/tests/data.json b/tests/data.json
new file mode 100644 (file)
index 0000000..dbcb0c6
--- /dev/null
@@ -0,0 +1,15 @@
+{
+  "test": "test",
+  "html_escaped": "< > & \"",
+  "true": true,
+  "false": false,
+  "list": [
+      {"i": 1, "v": "one"},
+      {"i": 2, "v": "two"},
+      {"i": 3, "v": "three"}
+  ],
+
+  "scope": {
+      "test": "new test"
+  }
+}
diff --git a/tests/partial.mustache b/tests/partial.mustache
new file mode 100644 (file)
index 0000000..55bd722
--- /dev/null
@@ -0,0 +1 @@
+this is a partial{{excited}}
diff --git a/tests/test.mustache b/tests/test.mustache
new file mode 100644 (file)
index 0000000..0597412
--- /dev/null
@@ -0,0 +1,121 @@
+{{!
+    mustache comment!
+}}
+
+variable test
+===
+{{ test }}
+===
+test
+===
+
+comment test
+===
+{{!
+    mustache comment
+}}
+===
+===
+
+html escape test (triple brackets)
+===
+{{{html_escaped}}}
+===
+< > & "
+===
+
+html escape test (ampersand)
+===
+{{& html_escaped}}
+===
+< > & "
+===
+
+html escape test (normal)
+===
+{{ html_escaped }}
+===
+&lt; &gt; &amp; &quot;
+===
+
+section test (truthy)
+===
+{{# true }}
+true
+{{/ true }}
+===
+true
+===
+
+section test (falsy)
+===
+{{# false }}
+ERROR
+{{/ false }}
+===
+===
+
+section test (list)
+===
+{{# list }}
+number: {{i}}
+name: {{v}}
+---
+{{/ list }}
+===
+number: 1
+name: one
+---
+number: 2
+name: two
+---
+number: 3
+name: three
+---
+===
+
+section test (scope)
+===
+{{ test }}
+{{# scope }}
+{{ test }}
+{{/ scope }}
+===
+test
+new test
+===
+
+inverted section test (truthy)
+===
+{{^ true }}
+ERROR
+{{/ true }}
+===
+===
+
+inverted section test (falsy)
+===
+{{^ false }}
+false
+{{/ false }}
+===
+false
+===
+
+partial test
+===
+{{> partial}}
+===
+this is a partial
+===
+
+delimiter test
+===
+{{=(( ))=}}
+(( test ))
+((={{ }}=))
+{{ test }}
+===
+test
+test
+===
diff --git a/tests/test.rendered b/tests/test.rendered
new file mode 100644 (file)
index 0000000..437acdf
--- /dev/null
@@ -0,0 +1,105 @@
+
+variable test
+===
+test
+===
+test
+===
+
+comment test
+===
+===
+===
+
+html escape test (triple brackets)
+===
+< > & "
+===
+< > & "
+===
+
+html escape test (ampersand)
+===
+< > & "
+===
+< > & "
+===
+
+html escape test (normal)
+===
+&lt; &gt; &amp; &quot;
+===
+&lt; &gt; &amp; &quot;
+===
+
+section test (truthy)
+===
+true
+===
+true
+===
+
+section test (falsy)
+===
+===
+===
+
+section test (list)
+===
+number: 1
+name: one
+---
+number: 2
+name: two
+---
+number: 3
+name: three
+---
+===
+number: 1
+name: one
+---
+number: 2
+name: two
+---
+number: 3
+name: three
+---
+===
+
+section test (scope)
+===
+test
+new test
+===
+test
+new test
+===
+
+inverted section test (truthy)
+===
+===
+===
+
+inverted section test (falsy)
+===
+false
+===
+false
+===
+
+partial test
+===
+this is a partial
+===
+this is a partial
+===
+
+delimiter test
+===
+test
+test
+===
+test
+test
+===