summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-06-18 23:34:42 +0100
committerMichael Williamson <mike@zwobble.org>2013-06-18 23:34:42 +0100
commitaf6662377ce4048c2214787ee2a1104a9f33839d (patch)
treee6f86bdcd439bc3167aad14dd1f716f3f67d2b10 /tests
Basic bindings for jq
Diffstat (limited to 'tests')
-rw-r--r--tests/jq_tests.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/jq_tests.py b/tests/jq_tests.py
new file mode 100644
index 0000000..0bef31f
--- /dev/null
+++ b/tests/jq_tests.py
@@ -0,0 +1,27 @@
+from nose.tools import istest, assert_equal
+
+import jq
+
+
+@istest
+def dot_operator_does_nothing():
+ assert_equal(
+ "42",
+ jq.string_to_string(".", "42")
+ )
+
+
+@istest
+def can_add_one_to_each_element_of_an_array():
+ assert_equal(
+ "[2,3,4]",
+ jq.string_to_string("[.[]+1]", "[1,2,3]")
+ )
+
+
+@istest
+def output_elements_are_separated_by_newlines():
+ assert_equal(
+ "1\n2\n3",
+ jq.string_to_string(".[]", "[1,2,3]")
+ )