summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2016-02-10 10:44:21 +0000
committerPatrick J Cherry <patrick@bytemark.co.uk>2016-02-10 10:44:21 +0000
commit62fc56d4bc7a7e85828520eb7c586cfe0cedd2fc (patch)
tree85625fb607bbf904f0bc01a6fc039acf74c32565 /t
parentc6f2c6f924e6b263be5a3ba4a4eb7049f27544d3 (diff)
Adjusted http with content string parsing.
It now matches "can't match" and 'he said "ha!"'. Added tests.
Diffstat (limited to 't')
-rwxr-xr-xt/test-custodian-parser.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/test-custodian-parser.rb b/t/test-custodian-parser.rb
index ddc1153..d9420a5 100755
--- a/t/test-custodian-parser.rb
+++ b/t/test-custodian-parser.rb
@@ -368,6 +368,28 @@ EOF
end
end
+ #
+ # Test that we can use lots of different strings for content.
+ #
+ def test_http_with_content_parsing
+ content_strings = [
+ "'bar in single quotes'",
+ '"bar in double quotes"',
+ "'bar in single quotes with \"embedded double quotes\"'",
+ '"bar in double quotes with \'embedded double quotes\'"',
+ ]
+
+ content_strings.each do |cs|
+ str = "http://example must run http with content #{cs}."
+ obj = Custodian::TestFactory.create(str)
+ assert(!obj.nil?)
+ assert(obj.kind_of? Array)
+ assert(obj.size == 1)
+
+ assert_equal(obj[0].to_s, str)
+ assert_equal(cs[1..-2], obj[0].expected_content)
+ end
+ end
#