Skip to content

Commit b1de99f

Browse files
author
Ben Slaughter
committed
Failing parse string scheme test
1 parent ad53a19 commit b1de99f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/initialize_data_test.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,21 @@ def test_parse_invalid_uri_string
9696
assert_raises(JSON::Schema::JsonLoadError) { JSON::Validator.validate(schema, data, :uri => true) }
9797
end
9898

99+
def test_parse_invalid_scheme_string
100+
schema = {'type' => 'string'}
101+
data = 'pick one: [1, 2, 3]'
102+
103+
assert(JSON::Validator.validate(schema, data))
104+
105+
assert(JSON::Validator.validate(schema, data, :parse_data => false))
106+
107+
assert_raises(JSON::Schema::JsonParseError) do
108+
JSON::Validator.validate(schema, data, :json => true)
109+
end
110+
111+
assert_raises(JSON::Schema::UriError) { JSON::Validator.validate(schema, data, :uri => true) }
112+
end
113+
99114
def test_parse_integer
100115
schema = {'type' => 'integer'}
101116
data = 42

0 commit comments

Comments
 (0)