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
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/json_pure-1.1.3/tests/test_json_fixtures.rb
poolparty-1.4.0 vendor/gems/json/tests/test_json_fixtures.rb
json-1.1.1-mswin32 tests/test_json_fixtures.rb
poolparty-1.3.15 vendor/gems/json/tests/test_json_fixtures.rb
poolparty-1.3.14 vendor/gems/json/tests/test_json_fixtures.rb
poolparty-1.3.13 vendor/gems/json/tests/test_json_fixtures.rb
poolparty-1.3.8 vendor/gems/json/tests/test_json_fixtures.rb
poolparty-1.3.7 vendor/gems/json/tests/test_json_fixtures.rb
poolparty-1.3.6 vendor/gems/json/tests/test_json_fixtures.rb
poolparty-1.3.4 vendor/gems/json/tests/test_json_fixtures.rb
poolparty-1.3.3 vendor/gems/json/tests/test_json_fixtures.rb
poolparty-1.3.1 vendor/gems/json/tests/test_json_fixtures.rb
json-1.1.2 tests/test_json_fixtures.rb
json-1.1.1 tests/test_json_fixtures.rb
json-1.1.3 tests/test_json_fixtures.rb
json-jruby-1.1.3-universal-java-1.6 tests/test_json_fixtures.rb
json-jruby-1.1.2-universal-java-1.6 tests/test_json_fixtures.rb
json-jruby-1.1.2-universal-java-1.5 tests/test_json_fixtures.rb
json-jruby-1.1.3-universal-java-1.5 tests/test_json_fixtures.rb
json_pure-1.1.3 tests/test_json_fixtures.rb