fjson 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,12 @@
1
+ 2006-11-04 (0.1.2)
2
+ * Applied patch by Marcus Rueckert to fix gem install
3
+
4
+ 2006-11-04 (0.1.1)
5
+ * Security release fixing seg fault. Thanks to Ooga Labs.
6
+
7
+ 2006-11-04 (0.1.0)
8
+ * FJSON is deprecated as of this release.
9
+
1
10
  2006-11-04 (0.0.8)
2
11
  * Fixed build issues. Better spec coverage on build.
3
12
 
data/Rakefile CHANGED
@@ -5,7 +5,10 @@ def win32?
5
5
  end
6
6
 
7
7
  desc "Compiles the library"
8
- task(:default) {mkmf_tasks.default}
8
+ task(:default) {mkmf_tasks.extension}
9
+
10
+ desc "Compiles the library"
11
+ task(:extension) {mkmf_tasks.extension}
9
12
 
10
13
  desc "Compiles the library"
11
14
  task(:compile) {mkmf_tasks.compile}
@@ -46,7 +49,7 @@ def mkmf_tasks
46
49
  end
47
50
 
48
51
  PKG_NAME = "fjson"
49
- PKG_VERSION = "0.1.1"
52
+ PKG_VERSION = "0.1.2"
50
53
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
51
54
  PKG_FILES = FileList[
52
55
  '[A-Z]*',
@@ -9,10 +9,6 @@ class MkmfTasks
9
9
  @actor = actor
10
10
  end
11
11
 
12
- def default
13
- compile
14
- end
15
-
16
12
  def compile
17
13
  @extension_paths.each do |extension|
18
14
  dir = "ext/#{extension}"
@@ -21,6 +17,11 @@ class MkmfTasks
21
17
  end
22
18
  end
23
19
 
20
+ def extension
21
+ compile
22
+ install
23
+ end
24
+
24
25
  def spec
25
26
  compile
26
27
  install
@@ -4,39 +4,39 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "A one dimensional Array" do
8
- specify "should create json" do
7
+ describe "A one dimensional Array" do
8
+ it "should create json" do
9
9
  array = [1, 'hello', :hello]
10
- array.to_json.should_eql '[1,"hello","hello"]'
10
+ array.to_json.should == '[1,"hello","hello"]'
11
11
  end
12
12
 
13
- specify "should allow child object to have to_json with no arguments" do
13
+ it "should allow child object to have to_json with no arguments" do
14
14
  obj = Object.new
15
15
  def obj.to_json
16
16
  "json".to_json
17
17
  end
18
18
 
19
19
  array = [obj]
20
- array.to_json.should_eql "[\"json\"]"
20
+ array.to_json.should == "[\"json\"]"
21
21
  end
22
22
  end
23
23
 
24
- context "A multi-dimensional Array" do
25
- specify "should create json" do
24
+ describe "A multi-dimensional Array" do
25
+ it "should create json" do
26
26
  array = [1, ['hello', [:hello]]]
27
- array.to_json.should_eql '[1,["hello",["hello"]]]'
27
+ array.to_json.should == '[1,["hello",["hello"]]]'
28
28
  end
29
29
 
30
- specify "should not support circular dependencies" do
30
+ it "should not support circular dependencies" do
31
31
  array = []
32
32
  array << 1
33
33
  array << ['hello', array]
34
- proc {array.to_json}.should_raise JSON::CircularDatastructure
34
+ proc {array.to_json}.should raise_error JSON::CircularDatastructure
35
35
  end
36
36
  end
37
37
 
38
- #context "Array performance" do
39
- # specify "" do
38
+ #describe "Array performance" do
39
+ # it "" do
40
40
  # begin_time = Time.now
41
41
  # 100000.times do
42
42
  # [1, ['hello', [:hello]]].to_json
@@ -4,12 +4,12 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "A false object" do
8
- specify "should convert to json" do
9
- false.to_json.should_eql "false"
7
+ describe "A false object" do
8
+ it "should convert to json" do
9
+ false.to_json.should == "false"
10
10
  end
11
11
 
12
- specify "to_json should accept any number of arguments" do
12
+ it "to_json should accept any number of arguments" do
13
13
  false.to_json(1, 2)
14
14
  end
15
15
  end
@@ -4,12 +4,12 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "A float number" do
8
- specify "should convert to json" do
9
- (3.14).to_json.should_eql "3.14"
7
+ describe "A float number" do
8
+ it "should convert to json" do
9
+ (3.14).to_json.should == "3.14"
10
10
  end
11
11
 
12
- specify "to_json should accept any number of arguments" do
12
+ it "to_json should accept any number of arguments" do
13
13
  (3.14).to_json(1, 2)
14
14
  end
15
15
  end
@@ -4,18 +4,18 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "A one dimensional Hash" do
8
- specify "should create json" do
7
+ describe "A one dimensional Hash" do
8
+ it "should create json" do
9
9
  hash = {
10
10
  :one => 1,
11
11
  "hello" => :hello
12
12
  }
13
13
  json = hash.to_json
14
- json.should_include "\"one\":1"
15
- json.should_include "\"hello\":\"hello\""
14
+ json.should include("\"one\":1")
15
+ json.should include("\"hello\":\"hello\"")
16
16
  end
17
17
 
18
- specify "should allow child object to have to_json with no arguments" do
18
+ it "should allow child object to have to_json with no arguments" do
19
19
  obj = Object.new
20
20
  def obj.to_json
21
21
  "json".to_json
@@ -25,12 +25,12 @@ context "A one dimensional Hash" do
25
25
  "key" => obj
26
26
  }
27
27
 
28
- hash.to_json.should_eql "{\"key\":\"json\"}"
28
+ hash.to_json.should == "{\"key\":\"json\"}"
29
29
  end
30
30
  end
31
31
 
32
- context "A multi-dimensional Hash" do
33
- specify "should create json" do
32
+ describe "A multi-dimensional Hash" do
33
+ it "should create json" do
34
34
  hash = {
35
35
  :one => 1,
36
36
  "hello" => {
@@ -38,13 +38,13 @@ context "A multi-dimensional Hash" do
38
38
  },
39
39
  }
40
40
  json = hash.to_json
41
- json.should_include "\"one\":1"
42
- json.should_include "\"hello\":{\"hello2\":2}"
41
+ json.should include("\"one\":1")
42
+ json.should include("\"hello\":{\"hello2\":2}")
43
43
  end
44
44
 
45
- specify "should not support circular dependencies" do
45
+ it "should not support circular dependencies" do
46
46
  hash = { :one => 1 }
47
47
  hash["hello"] = hash
48
- proc {hash.to_json}.should_raise JSON::CircularDatastructure
48
+ proc {hash.to_json}.should raise_error(JSON::CircularDatastructure)
49
49
  end
50
50
  end
@@ -4,12 +4,12 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "An integer" do
8
- specify "should convert to json" do
9
- 5.to_json.should_eql "5"
7
+ describe "An integer" do
8
+ it "should convert to json" do
9
+ 5.to_json.should == "5"
10
10
  end
11
11
 
12
- specify "to_json should accept any number of arguments" do
12
+ it "to_json should accept any number of arguments" do
13
13
  5.to_json(1, 2)
14
14
  end
15
15
  end
@@ -1,8 +1,8 @@
1
1
  dir = File.dirname(__FILE__)
2
2
  require "#{dir}/spec_helper"
3
3
 
4
- context "A MkmfTasks" do
5
- setup do
4
+ describe MkmfTasks, :shared => true do
5
+ before(:each) do
6
6
  @actor = mock("Rake Actor")
7
7
  @tasks = MkmfTasks.new(@actor)
8
8
 
@@ -10,13 +10,12 @@ context "A MkmfTasks" do
10
10
  @extconf_file_name = @tasks.extconf_file_name = "extconf.mkmf.rb"
11
11
  @project_dir = @tasks.project_dir = "/project/dir"
12
12
  end
13
+ end
13
14
 
14
- specify "default is compile" do
15
- @tasks.should_receive(:compile)
16
- @tasks.default
17
- end
18
-
19
- specify "compile makes files" do
15
+ describe MkmfTasks, "#compile" do
16
+ it_should_behave_like "MkmfTasks"
17
+
18
+ it "makes files" do
20
19
  @tasks.extension_paths = ["foo", "extensions/bar"]
21
20
  @tasks.extconf_arguments = "-extconfarg"
22
21
  @tasks.extconf_file_name = "extconf.rb"
@@ -41,20 +40,42 @@ context "A MkmfTasks" do
41
40
 
42
41
  @tasks.compile
43
42
  end
43
+ end
44
+
45
+ describe MkmfTasks, "#extension" do
46
+ it_should_behave_like "MkmfTasks"
44
47
 
45
- specify "spec calls compile, install, and runs the specs" do
48
+ it "compiles and installs extensions" do
49
+ @tasks.should_receive(:compile).ordered
50
+ @tasks.should_receive(:install).ordered
51
+ @tasks.extension
52
+ end
53
+ end
54
+
55
+ describe MkmfTasks, "#spec" do
56
+ it_should_behave_like "MkmfTasks"
57
+
58
+ it "calls compile, install, and runs the specs" do
46
59
  @tasks.should_receive(:compile).ordered
47
60
  @tasks.should_receive(:install).ordered
48
61
  @tasks.should_receive(:require).with("#{@project_dir}/spec/spec_suite").ordered
49
62
  @tasks.spec
50
63
  end
64
+ end
65
+
66
+ describe MkmfTasks, "#lib" do
67
+ it_should_behave_like "MkmfTasks"
51
68
 
52
- specify "lib create lib directory" do
69
+ it "creates lib directory" do
53
70
  @tasks.should_receive(:directory).with("lib")
54
71
  @tasks.lib
55
72
  end
73
+ end
74
+
75
+ describe MkmfTasks, "#install" do
76
+ it_should_behave_like "MkmfTasks"
56
77
 
57
- specify "install copies the build path to the library path" do
78
+ it "copies the build path to the library path" do
58
79
  @tasks.extension_paths = ["foo", "extensions/bar"]
59
80
  @tasks.file_extension = "so"
60
81
  File.stub!(:exists?).and_return(true)
@@ -63,16 +84,20 @@ context "A MkmfTasks" do
63
84
  @tasks.install
64
85
  end
65
86
 
66
- specify "install raises an exception when the source file does not exist" do
87
+ it "raises an exception when the source file does not exist" do
67
88
  @tasks.extension_paths = ["foo", "extensions/bar"]
68
89
  @tasks.file_extension = "so"
69
90
  File.should_receive(:exists?).with("/project/dir/ext/foo/foo.so").and_return(false)
70
91
  proc do
71
92
  @tasks.install
72
- end.should_raise(Exception, "File /project/dir/ext/foo/foo.so does not exist")
93
+ end.should raise_error(Exception, "File /project/dir/ext/foo/foo.so does not exist")
73
94
  end
95
+ end
96
+
97
+ describe MkmfTasks, "#cleanup" do
98
+ it_should_behave_like "MkmfTasks"
74
99
 
75
- specify "cleanup removes all of the build artifacts" do
100
+ it "removes all of the build artifacts" do
76
101
  @tasks.extension_paths = ["extensions/foo", "extensions/bar"]
77
102
  @tasks.file_extension = "file_extension"
78
103
 
@@ -4,12 +4,12 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "A nil object" do
8
- specify "should convert to json" do
9
- nil.to_json.should_eql "null"
7
+ describe "A nil object" do
8
+ it "should convert to json" do
9
+ nil.to_json.should == "null"
10
10
  end
11
11
 
12
- specify "to_json should accept any number of arguments" do
12
+ it "to_json should accept any number of arguments" do
13
13
  nil.to_json(1, 2)
14
14
  end
15
15
  end
@@ -4,14 +4,14 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "An object" do
8
- specify "should convert its string representation to json" do
7
+ describe "An object" do
8
+ it "should convert its string representation to json" do
9
9
  obj = Object.new
10
10
  obj_str = obj.to_s
11
- obj.to_json.should_eql '"' + obj_str + '"'
11
+ obj.to_json.should == '"' + obj_str + '"'
12
12
  end
13
13
 
14
- specify "to_json should accept any number of arguments" do
14
+ it "to_json should accept any number of arguments" do
15
15
  Object.new.to_json(1, 2)
16
16
  end
17
17
  end
@@ -8,11 +8,11 @@ unless args.include?("-f") || args.include?("--format")
8
8
  end
9
9
  args << $0
10
10
 
11
- $context_runner = ::Spec::Runner::OptionParser.new.create_context_runner(args, false, STDOUT, STDERR)
11
+ $behaviour_runner = ::Spec::Runner::OptionParser.new.create_behaviour_runner(args, false, STDOUT, STDERR)
12
12
 
13
13
  dir = File.dirname(__FILE__)
14
14
  Dir["#{dir}/**/*_spec.rb"].each do |file|
15
15
  require File.expand_path(file)
16
16
  end
17
17
 
18
- $context_runner.run(false)
18
+ $behaviour_runner.run(nil, true)
@@ -4,13 +4,13 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "A JSON state" do
8
- specify "method from_state should return the passed in object when a state is passed in" do
7
+ describe "A JSON state" do
8
+ it "method from_state should return the passed in object when a state is passed in" do
9
9
  state = JSON::State.new
10
- JSON::State.from_state(state).should_eql state
10
+ JSON::State.from_state(state).should == state
11
11
  end
12
12
 
13
- specify "method from_state should return a new state with hash values when a hash is passed in" do
13
+ it "method from_state should return a new state with hash values when a hash is passed in" do
14
14
  shim_state_class = Object.new
15
15
  shim_state_class.extend JSON::State::ClassMethods
16
16
  passed_params = nil
@@ -18,24 +18,24 @@ context "A JSON state" do
18
18
 
19
19
  args = {}
20
20
  shim_state_class.from_state(args)
21
- passed_params.should_eql args
21
+ passed_params.should == args
22
22
  end
23
23
 
24
- specify "method from_state should return a new state with default parameters when an object that is not " +
24
+ it "method from_state should return a new state with default parameters when an object that is not " +
25
25
  "a state or a hash is passed in" do
26
26
  state = JSON::State.from_state(Object.new)
27
- state.should_be_instance_of JSON::State
27
+ state.should be_instance_of(JSON::State)
28
28
  end
29
29
 
30
- specify "should initialize its attributes to their defaults" do
30
+ it "should initialize its attributes to their defaults" do
31
31
  state = JSON::State.new
32
- state.indent.should_eql ""
33
- state.space.should_eql ""
34
- state.object_nl.should_eql ""
35
- state.array_nl.should_eql ""
32
+ state.indent.should == ""
33
+ state.space.should == ""
34
+ state.object_nl.should == ""
35
+ state.array_nl.should == ""
36
36
  end
37
37
 
38
- specify "should initialize its attributes with passed in values" do
38
+ it "should initialize its attributes with passed in values" do
39
39
  params = {
40
40
  :indent => Object.new,
41
41
  :space => Object.new,
@@ -43,24 +43,24 @@ context "A JSON state" do
43
43
  :array_nl => Object.new
44
44
  }
45
45
  state = JSON::State.new(params)
46
- state.indent.should_eql params[:indent]
47
- state.space.should_eql params[:space]
48
- state.object_nl.should_eql params[:object_nl]
49
- state.array_nl.should_eql params[:array_nl]
46
+ state.indent.should == params[:indent]
47
+ state.space.should == params[:space]
48
+ state.object_nl.should == params[:object_nl]
49
+ state.array_nl.should == params[:array_nl]
50
50
  end
51
51
 
52
- specify "should remember objects" do
52
+ it "should remember objects" do
53
53
  state = JSON::State.new
54
54
  obj = Object.new
55
55
  state.remember(obj)
56
- state.should_be_seen(obj)
56
+ state.should be_seen(obj)
57
57
  end
58
58
 
59
- specify "should forget objects" do
59
+ it "should forget objects" do
60
60
  state = JSON::State.new
61
61
  obj = Object.new
62
62
  state.remember(obj)
63
63
  state.forget(obj)
64
- state.should_not_be_seen(obj)
64
+ state.should_not be_seen(obj)
65
65
  end
66
66
  end
@@ -4,12 +4,12 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "A string" do
8
- specify "should convert to json" do
9
- "test".to_json.should_eql '"test"'
7
+ describe "A string" do
8
+ it "should convert to json" do
9
+ "test".to_json.should == '"test"'
10
10
  end
11
11
 
12
- specify "to_json should accept any number of arguments" do
12
+ it "to_json should accept any number of arguments" do
13
13
  "test".to_json(1, 2)
14
14
  end
15
15
  end
@@ -4,15 +4,15 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "String when not supporting unicode and KCODE is not UTF8 json" do
7
+ describe "String when not supporting unicode and KCODE is not UTF8 json" do
8
8
  setup do
9
9
  JSON.support_unicode = true
10
10
  $KCODE = ""
11
11
  end
12
12
 
13
- specify "should let high values pass through when " +
13
+ it "should let high values pass through when " +
14
14
  "not supporting unicode and KCODE is not UTF8" do
15
15
  val = [0xcf].pack("U")
16
- JSON.utf8_to_json(val).should_eql "\303\217"
16
+ JSON.utf8_to_json(val).should == "\303\217"
17
17
  end
18
18
  end
@@ -4,15 +4,15 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "String when supporting unicode and KCODE is not utf8 json" do
7
+ describe "String when supporting unicode and KCODE is not utf8 json" do
8
8
  setup do
9
9
  JSON.support_unicode = true
10
10
  $KCODE = ""
11
11
  end
12
12
 
13
- specify "should let high values pass through when " +
13
+ it "should let high values pass through when " +
14
14
  "supporting unicode and KCODE is not UTF8" do
15
15
  val = [0xcf].pack("U")
16
- JSON.utf8_to_json(val).should_eql "\303\217"
16
+ JSON.utf8_to_json(val).should == "\303\217"
17
17
  end
18
18
  end
@@ -4,64 +4,64 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "String with latin1 character set Json" do
8
- specify 'should format \b' do
7
+ describe "String with latin1 character set Json" do
8
+ it 'should format \b' do
9
9
  utf_8_val = [?\b].pack("U")
10
- JSON.utf8_to_json(utf_8_val).should_eql '\b'
10
+ JSON.utf8_to_json(utf_8_val).should == '\b'
11
11
  end
12
12
 
13
- specify 'should format \t' do
13
+ it 'should format \t' do
14
14
  utf_8_val = [?\t].pack("U")
15
- JSON.utf8_to_json(utf_8_val).should_eql '\t'
15
+ JSON.utf8_to_json(utf_8_val).should == '\t'
16
16
  end
17
17
 
18
- specify 'should format \n' do
18
+ it 'should format \n' do
19
19
  utf_8_val = [?\n].pack("U")
20
- JSON.utf8_to_json(utf_8_val).should_eql '\n'
20
+ JSON.utf8_to_json(utf_8_val).should == '\n'
21
21
  end
22
22
 
23
- specify 'should format \f' do
23
+ it 'should format \f' do
24
24
  utf_8_val = [?\f].pack("U")
25
- JSON.utf8_to_json(utf_8_val).should_eql '\f'
25
+ JSON.utf8_to_json(utf_8_val).should == '\f'
26
26
  end
27
27
 
28
- specify 'should format \r' do
28
+ it 'should format \r' do
29
29
  utf_8_val = [?\r].pack("U")
30
- JSON.utf8_to_json(utf_8_val).should_eql '\r'
30
+ JSON.utf8_to_json(utf_8_val).should == '\r'
31
31
  end
32
32
 
33
- specify 'should format ?"' do
33
+ it 'should format ?"' do
34
34
  utf_8_val = [?"].pack("U")
35
- JSON.utf8_to_json(utf_8_val).should_eql '\"'
35
+ JSON.utf8_to_json(utf_8_val).should == '\"'
36
36
  end
37
37
 
38
- specify 'should format ?\\' do
38
+ it 'should format ?\\' do
39
39
  utf_8_val = [?\\].pack("U")
40
- JSON.utf8_to_json(utf_8_val).should_eql '\\\\'
40
+ JSON.utf8_to_json(utf_8_val).should == '\\\\'
41
41
  end
42
42
 
43
- specify "should format values between 0x00 and 0x1f" do
43
+ it "should format values between 0x00 and 0x1f" do
44
44
  utf_8_val = [0x0f].pack("U")
45
- JSON.utf8_to_json(utf_8_val).should_eql '\\u000f'
45
+ JSON.utf8_to_json(utf_8_val).should == '\\u000f'
46
46
  utf_8_val = [0x1e].pack("U")
47
- JSON.utf8_to_json(utf_8_val).should_eql '\\u001e'
47
+ JSON.utf8_to_json(utf_8_val).should == '\\u001e'
48
48
  end
49
49
 
50
- specify "should let ordinary text pass through" do
51
- JSON.utf8_to_json("test").should_eql "test"
52
- JSON.utf8_to_json('1').should_eql '1'
50
+ it "should let ordinary text pass through" do
51
+ JSON.utf8_to_json("test").should == "test"
52
+ JSON.utf8_to_json('1').should == '1'
53
53
  end
54
54
 
55
- specify "should support backslashes" do
55
+ it "should support backslashes" do
56
56
  json = '"\\\\.(?i:gif|jpe?g|png)$"'
57
57
  data = JSON.parse(json)
58
- JSON.unparse(data).should_eql json
58
+ JSON.unparse(data).should == json
59
59
  json = '"\\""'
60
60
  data = JSON.parse(json)
61
- JSON.unparse(data).should_eql json
61
+ JSON.unparse(data).should == json
62
62
  json = '"\/"'
63
63
  data = JSON.parse(json)
64
- data.should_eql '/'
65
- JSON.unparse(data).should_eql json
64
+ data.should == '/'
65
+ JSON.unparse(data).should == json
66
66
  end
67
67
  end
@@ -4,50 +4,50 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "String with UTF8 values when supporting unicode Json" do
7
+ describe "String with UTF8 values when supporting unicode Json" do
8
8
  setup do
9
9
  JSON.support_unicode = true
10
10
  $KCODE = "UTF8"
11
11
  end
12
12
 
13
- specify "should format values between 0x00000080 and 0x000007ff" do
13
+ it "should format values between 0x00000080 and 0x000007ff" do
14
14
  val = [0x0080].pack("U")
15
- JSON.utf8_to_json(val).should_eql "\\u0080"
15
+ JSON.utf8_to_json(val).should == "\\u0080"
16
16
 
17
17
  val = [0x07ff].pack("U")
18
- JSON.utf8_to_json(val).should_eql "\\u07ff"
18
+ JSON.utf8_to_json(val).should == "\\u07ff"
19
19
  end
20
20
 
21
- specify "should format values between 0x00001000 and 0x0000ffff" do
21
+ it "should format values between 0x00001000 and 0x0000ffff" do
22
22
  val = [0x1000].pack("U")
23
- JSON.utf8_to_json(val).should_eql "\\u1000"
23
+ JSON.utf8_to_json(val).should == "\\u1000"
24
24
 
25
25
  val = [0xffff].pack("U")
26
- JSON.utf8_to_json(val).should_eql "\\uffff"
26
+ JSON.utf8_to_json(val).should == "\\uffff"
27
27
  end
28
28
 
29
- specify "should format values between 0x00010000 and 0x0010ffff" do
29
+ it "should format values between 0x00010000 and 0x0010ffff" do
30
30
  val = [0x010000].pack("U")
31
- JSON.utf8_to_json(val).should_eql "\\ud800dc00"
31
+ JSON.utf8_to_json(val).should == "\\ud800dc00"
32
32
 
33
33
  val = [0x10ffff].pack("U")
34
- JSON.utf8_to_json(val).should_eql "\\udbffdfff"
34
+ JSON.utf8_to_json(val).should == "\\udbffdfff"
35
35
  end
36
36
 
37
- specify "should parse unicode values" do
37
+ it "should parse unicode values" do
38
38
  utf8 = '© ≠ €!'
39
39
  json = '"\u00a9 \u2260 \u20ac!"'
40
- utf8.to_json.should_eql json
41
- JSON.parse(json).should_eql utf8
40
+ utf8.to_json.should == json
41
+ JSON.parse(json).should == utf8
42
42
 
43
43
  utf8 = "\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212"
44
44
  json = '"\u3042\u3044\u3046\u3048\u304a"'
45
- utf8.to_json.should_eql json
46
- JSON.parse(json).should_eql utf8
45
+ utf8.to_json.should == json
46
+ JSON.parse(json).should == utf8
47
47
 
48
48
  utf8 = 'საქართველო'
49
49
  json = '"\u10e1\u10d0\u10e5\u10d0\u10e0\u10d7\u10d5\u10d4\u10da\u10dd"'
50
- utf8.to_json.should_eql json
51
- JSON.parse(json).should_eql utf8
50
+ utf8.to_json.should == json
51
+ JSON.parse(json).should == utf8
52
52
  end
53
53
  end
@@ -4,12 +4,12 @@ dir = File.dirname(__FILE__)
4
4
  require File.expand_path("#{dir}/spec_helper")
5
5
  require File.expand_path("#{dir}/../lib/fjson")
6
6
 
7
- context "A true object" do
8
- specify "should convert to json" do
9
- true.to_json.should_eql "true"
7
+ describe "A true object" do
8
+ it "should convert to json" do
9
+ true.to_json.should == "true"
10
10
  end
11
11
 
12
- specify "to_json should accept any number of arguments" do
12
+ it "to_json should accept any number of arguments" do
13
13
  true.to_json(1, 2)
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.3
3
3
  specification_version: 1
4
4
  name: fjson
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.1
7
- date: 2007-04-30 00:00:00 -07:00
6
+ version: 0.1.2
7
+ date: 2007-05-25 00:00:00 -07:00
8
8
  summary: This library is for parsing JSON strings and unparsing ruby data structures. This library is a fork of Florian Frank's JSON library with key parts implemented in C for performance improvements.
9
9
  require_paths:
10
10
  - lib
@@ -34,100 +34,100 @@ files:
34
34
  - CHANGES
35
35
  - TODO
36
36
  - README
37
- - hash_benchmark.rb
38
37
  - rake_helper.rb
39
- - install.rb
40
38
  - hash_benchmark_action_support.rb
41
39
  - hash_benchmark_json.rb
42
- - hash_benchmark_fjson.rb
43
40
  - mkmf_tasks.rb
44
- - lib/parser.rb
41
+ - hash_benchmark.rb
42
+ - hash_benchmark_fjson.rb
43
+ - install.rb
45
44
  - lib/fjson.rb
46
- - lib/extensions/kernel.rb
47
- - lib/extensions/class.rb
48
- - lib/extensions/string.rb
45
+ - lib/parser.rb
49
46
  - lib/json/editor.rb
47
+ - lib/extensions/string.rb
48
+ - lib/extensions/class.rb
49
+ - lib/extensions/kernel.rb
50
+ - ext/state_ext/state_lib.h
51
+ - ext/state_ext/state_ext.h
52
+ - ext/json_ext/json_ext.h
50
53
  - ext/extensions/false_class_ext/false_class_ext.h
51
54
  - ext/extensions/hash_ext/hash_ext.h
52
- - ext/extensions/true_class_ext/true_class_ext.h
55
+ - ext/extensions/enumerable/enumerable.h
53
56
  - ext/extensions/float_ext/float_ext.h
54
- - ext/extensions/object_ext/object_ext.h
55
57
  - ext/extensions/string_ext/string_ext.h
58
+ - ext/extensions/array_ext/array_ext.h
56
59
  - ext/extensions/nil_class_ext/nil_class_ext.h
60
+ - ext/extensions/true_class_ext/true_class_ext.h
57
61
  - ext/extensions/integer_ext/integer_ext.h
58
- - ext/extensions/array_ext/array_ext.h
59
- - ext/extensions/enumerable/enumerable.h
60
- - ext/state_ext/state_ext.h
61
- - ext/state_ext/state_lib.h
62
- - ext/json_ext/json_ext.h
62
+ - ext/extensions/object_ext/object_ext.h
63
+ - ext/state_ext/state_ext.c
64
+ - ext/state_ext/state_lib.c
65
+ - ext/json_ext/json_ext.c
63
66
  - ext/extensions/false_class_ext/false_class_ext.c
64
67
  - ext/extensions/hash_ext/hash_ext.c
65
- - ext/extensions/true_class_ext/true_class_ext.c
68
+ - ext/extensions/enumerable/enumerable.c
66
69
  - ext/extensions/float_ext/float_ext.c
67
- - ext/extensions/object_ext/object_ext.c
68
70
  - ext/extensions/string_ext/string_ext.c
71
+ - ext/extensions/array_ext/array_ext.c
69
72
  - ext/extensions/nil_class_ext/nil_class_ext.c
73
+ - ext/extensions/true_class_ext/true_class_ext.c
70
74
  - ext/extensions/integer_ext/integer_ext.c
71
- - ext/extensions/array_ext/array_ext.c
72
- - ext/extensions/enumerable/enumerable.c
73
- - ext/state_ext/state_ext.c
74
- - ext/state_ext/state_lib.c
75
- - ext/json_ext/json_ext.c
75
+ - ext/extensions/object_ext/object_ext.c
76
+ - ext/state_ext/extconf.mkmf.rb
77
+ - ext/state_ext/extconf.rb
78
+ - ext/json_ext/extconf.mkmf.rb
79
+ - ext/json_ext/extconf.rb
76
80
  - ext/extensions/false_class_ext/extconf.mkmf.rb
77
81
  - ext/extensions/false_class_ext/extconf.rb
78
82
  - ext/extensions/hash_ext/extconf.mkmf.rb
79
83
  - ext/extensions/hash_ext/extconf.rb
80
- - ext/extensions/true_class_ext/extconf.mkmf.rb
81
- - ext/extensions/true_class_ext/extconf.rb
82
84
  - ext/extensions/float_ext/extconf.mkmf.rb
83
85
  - ext/extensions/float_ext/extconf.rb
84
- - ext/extensions/object_ext/extconf.mkmf.rb
85
- - ext/extensions/object_ext/extconf.rb
86
86
  - ext/extensions/string_ext/extconf.mkmf.rb
87
87
  - ext/extensions/string_ext/extconf.rb
88
+ - ext/extensions/array_ext/extconf.mkmf.rb
89
+ - ext/extensions/array_ext/extconf.rb
88
90
  - ext/extensions/nil_class_ext/extconf.mkmf.rb
89
91
  - ext/extensions/nil_class_ext/extconf.rb
92
+ - ext/extensions/true_class_ext/extconf.mkmf.rb
93
+ - ext/extensions/true_class_ext/extconf.rb
90
94
  - ext/extensions/integer_ext/extconf.mkmf.rb
91
95
  - ext/extensions/integer_ext/extconf.rb
92
- - ext/extensions/array_ext/extconf.mkmf.rb
93
- - ext/extensions/array_ext/extconf.rb
94
- - ext/state_ext/extconf.mkmf.rb
95
- - ext/state_ext/extconf.rb
96
- - ext/json_ext/extconf.mkmf.rb
97
- - ext/json_ext/extconf.rb
98
- - spec/mkmf_tasks_spec.rb
99
- - spec/true_class_spec.rb
100
- - spec/float_spec.rb
101
- - spec/string_spec.rb
102
- - spec/object_spec.rb
103
- - spec/nil_class_spec.rb
96
+ - ext/extensions/object_ext/extconf.mkmf.rb
97
+ - ext/extensions/object_ext/extconf.rb
104
98
  - spec/array_spec.rb
99
+ - spec/object_spec.rb
100
+ - spec/spec_suite.rb
101
+ - spec/string_when_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
105
102
  - spec/spec_helper.rb
106
103
  - spec/false_class_spec.rb
107
- - spec/string_when_not_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
108
- - spec/state_spec.rb
104
+ - spec/string_spec.rb
109
105
  - spec/hash_spec.rb
110
- - spec/spec_suite.rb
111
- - spec/integer_spec.rb
112
- - spec/string_when_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
106
+ - spec/nil_class_spec.rb
107
+ - spec/state_spec.rb
113
108
  - spec/string_with_latin1_character_set_json_spec.rb
114
- - spec/string_with_utf8_values_when_supporting_unicode_json_spec.rb
115
- test_files:
116
109
  - spec/mkmf_tasks_spec.rb
117
110
  - spec/true_class_spec.rb
111
+ - spec/string_when_not_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
112
+ - spec/string_with_utf8_values_when_supporting_unicode_json_spec.rb
113
+ - spec/integer_spec.rb
118
114
  - spec/float_spec.rb
119
- - spec/string_spec.rb
120
- - spec/object_spec.rb
121
- - spec/nil_class_spec.rb
115
+ test_files:
122
116
  - spec/array_spec.rb
117
+ - spec/object_spec.rb
118
+ - spec/string_when_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
123
119
  - spec/false_class_spec.rb
124
- - spec/string_when_not_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
125
- - spec/state_spec.rb
120
+ - spec/string_spec.rb
126
121
  - spec/hash_spec.rb
127
- - spec/integer_spec.rb
128
- - spec/string_when_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
122
+ - spec/nil_class_spec.rb
123
+ - spec/state_spec.rb
129
124
  - spec/string_with_latin1_character_set_json_spec.rb
125
+ - spec/mkmf_tasks_spec.rb
126
+ - spec/true_class_spec.rb
127
+ - spec/string_when_not_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
130
128
  - spec/string_with_utf8_values_when_supporting_unicode_json_spec.rb
129
+ - spec/integer_spec.rb
130
+ - spec/float_spec.rb
131
131
  rdoc_options: []
132
132
 
133
133
  extra_rdoc_files: