Sha256: c58ff57ed43d605d6e2f70dd895e077462eb6004b9ded864a663d50150e09b17
Contents?: true
Size: 776 Bytes
Versions: 103
Compression:
Stored size: 776 Bytes
Contents
#!/usr/bin/env ruby require 'test/unit' require 'json' class TC_JSONFixtures < Test::Unit::TestCase def setup $KCODE = 'UTF8' fixtures = File.join(File.dirname(__FILE__), 'fixtures/*.json') passed, failed = Dir[fixtures].partition { |f| f['pass'] } @passed = passed.inject([]) { |a, f| a << [ f, File.read(f) ] }.sort @failed = failed.inject([]) { |a, f| a << [ f, File.read(f) ] }.sort end def test_passing for name, source in @passed assert JSON.parse(source), "Did not pass for fixture '#{name}'" end end def test_failing for name, source in @failed assert_raises(JSON::ParserError, JSON::NestingError, "Did not fail for fixture '#{name}'") do JSON.parse(source) end end end end
Version data entries
103 entries across 97 versions & 16 rubygems
Version | Path |
---|---|
json_pure-1.1.2 | tests/test_json_fixtures.rb |
json_pure-1.1.1 | tests/test_json_fixtures.rb |
typo-5.3 | vendor/gems/json-1.1.3/tests/test_json_fixtures.rb |