summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-05-01 19:06:41 +0100
committerMichael Williamson <mike@zwobble.org>2023-05-01 19:08:38 +0100
commitb05b927c7af12be7b2115a642a7d54f5d0f6b08f (patch)
tree06972f35a7ff477098630acb9812dbfe08bc6d91
parentbebc3653452c60e64e14a1a7d1b476ee75b2ae8a (diff)
Test slurping of empty input text
-rw-r--r--tests/jq_tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/jq_tests.py b/tests/jq_tests.py
index 5f6bb16..bf40679 100644
--- a/tests/jq_tests.py
+++ b/tests/jq_tests.py
@@ -97,6 +97,14 @@ def test_input_can_be_text_with_multiple_values_separated_by_newlines():
assert_equal([1, 2, 3], result)
+def test_slurping_empty_input_text_reads_input_as_empty_array():
+ program = jq.compile(".")
+
+ result = program.input_text("1\n2\n3\n", slurp=True).all()
+
+ assert_equal([[1, 2, 3]], result)
+
+
def test_slurping_input_text_reads_input_as_single_array():
program = jq.compile(".")