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
benschwarz-smoke-0.5.2 vendor/json-1.1.3/tests/test_json_fixtures.rb
benschwarz-smoke-0.5.3 vendor/json-1.1.3/tests/test_json_fixtures.rb
benschwarz-smoke-0.5.4 vendor/json-1.1.3/tests/test_json_fixtures.rb
benschwarz-smoke-0.5.5 vendor/json-1.1.3/tests/test_json_fixtures.rb
benschwarz-smoke-0.5.6 vendor/json-1.1.3/tests/test_json_fixtures.rb
benschwarz-smoke-0.5.7 vendor/gems/gems/json-1.1.3/tests/test_json_fixtures.rb
fairchild-poolparty-1.3.17 vendor/gems/json/tests/test_json_fixtures.rb
fairchild-poolparty-1.3.5 vendor/gems/json/tests/test_json_fixtures.rb
genki-json-1.1.4.1 tests/test_json_fixtures.rb
masover-castronaut-0.4.4.4 vendor/json/tests/test_json_fixtures.rb
masover-castronaut-0.4.4.5 vendor/json/tests/test_json_fixtures.rb
masover-castronaut-0.5.0.1 vendor/json/tests/test_json_fixtures.rb
p8-castronaut-0.6.1.1 vendor/json/tests/test_json_fixtures.rb
relevance-castronaut-0.4.1 vendor/json/tests/test_json_fixtures.rb
relevance-castronaut-0.4.2 vendor/json/tests/test_json_fixtures.rb
relevance-castronaut-0.4.3 vendor/json/tests/test_json_fixtures.rb
relevance-castronaut-0.4.4 vendor/json/tests/test_json_fixtures.rb
relevance-castronaut-0.4.5 vendor/json/tests/test_json_fixtures.rb
relevance-castronaut-0.4.6 vendor/json/tests/test_json_fixtures.rb
relevance-castronaut-0.5.0 vendor/json/tests/test_json_fixtures.rb