RFC7159 7159.03 → 7159.04

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e2193ac3f36ae04eb2550b20bd9a702c525ffec
4
- data.tar.gz: e153ac6d024a5d50b97d056ed719e374e063a2c2
3
+ metadata.gz: cde0201e044e37ab14b2426a4211058753632042
4
+ data.tar.gz: 19b26b85d1f3f455b8dee3b591c403c729f88ed9
5
5
  SHA512:
6
- metadata.gz: b5398ed85120f830d7d79d1f585c5d11585e957f59acdc37934d035c2cb4a1f7dd2ad7873ee1552cf8beb363dd2a1bda518f2334d8d5bb5e1efede58ea9367d6
7
- data.tar.gz: 03726d87ea1d0cd0807098037ca757c0d7f6fe64a5ad09447289ecee12413d2c9c3e4100b15c04bc9b5c303d74f2444402737e62844be71057a0b99316c24346
6
+ metadata.gz: 54d23d27b59f817e73fe5da58b35f59ca86f1f4cee5527221c9831efbaf6a606427f8783a63df4d268a1793c14734661420442132cd11acb075111f4cef73687
7
+ data.tar.gz: 6ef984c3d3b5569fb5c2c9dbc708b714c2d9678f77be69b3023c31be5a82a0bfb5036c9fe4aa2cfff483e4782b6a3f6eee3054b5953f06691154b51aa6108043
@@ -33,11 +33,17 @@
33
33
 
34
34
  # coding: utf-8
35
35
 
36
- require_relative 'lib/RFC7159/version'
36
+ # hack avoid namespace pollution
37
+ path = File.expand_path 'lib/RFC7159/version.rb', __dir__
38
+ content = File.read path
39
+ version = Module.new.module_eval <<-'end'
40
+ RFC7159 = Module.new
41
+ eval content, binding, path
42
+ end
37
43
 
38
44
  Gem::Specification.new do |spec|
39
45
  spec.name = 'RFC7159'
40
- spec.version = RFC7159::VERSION
46
+ spec.version = version
41
47
  spec.authors = %w'Urabe, Shyouhei'
42
48
  spec.email = %w'shyouhei@ruby-lang.org'
43
49
  spec.summary = 'RFC7159 parser / generator'
data/Rakefile CHANGED
@@ -55,6 +55,7 @@ YARD::Rake::YardocTask.new
55
55
  task yard: 'lib/RFC7159/parser.rb'
56
56
  task rdoc: 'lib/RFC7159/parser.rb'
57
57
  task build: 'lib/RFC7159/parser.rb'
58
+ task spec: 'lib/RFC7159/parser.rb'
58
59
  file 'lib/RFC7159/parser.rb' => %w'lib/RFC7159/parser.ry' do |t|
59
60
  sh "bundle exec racc --debug --output-file=#{t.name} #{t.prerequisites.first}"
60
61
  end
@@ -110,8 +110,8 @@ class RFC7159::Dumper
110
110
  # - empty arrays and empty hashes are special-cased OK.
111
111
  # - other cases are subject to appear exactly once.
112
112
  def ensure_unique obj
113
- if @bag.include? obj and not obj2.empty?
114
- raise Errno::ELOOP, "target appears twice: #{target.inspect}"
113
+ if @bag.include? obj and not obj.empty?
114
+ raise Errno::ELOOP, "target appears twice: #{obj.inspect}"
115
115
  else
116
116
  begin
117
117
  @bag.store obj, obj
@@ -31,10 +31,8 @@
31
31
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
32
  # POSSIBILITY OF SUCH DAMAGE.
33
33
 
34
- require_relative '../RFC7159'
35
-
36
34
  # The version
37
- RFC7159::VERSION = 7159.03
35
+ RFC7159::VERSION = 7159.04
38
36
 
39
37
  #
40
38
  # Local Variables:
@@ -104,6 +104,7 @@ describe RFC7159 do
104
104
  0 => '0',
105
105
  0.5 => '0.5', # 0.5 has no error
106
106
  'foo' => '"foo"',
107
+ "\"\\\/\b\f\n\r\t"=> '"\"\\\/\b\f\n\r\t"',
107
108
  "\u{dead}" => '"\\uDEAD"', # invalid UTF8 to be valid escaped UTF8
108
109
  'foo'.encode('utf-32le') => '"foo"',
109
110
  "\xDE\xAD".force_encoding('utf-16be') => '"\\uDEAD"',
@@ -132,6 +133,12 @@ describe RFC7159 do
132
133
  it { expect{RFC7159.dump src}.to raise_exception }
133
134
  end
134
135
  end
136
+
137
+ it 'raises for loops' do
138
+ expect do
139
+ RFC7159.dump [].tap {|i| i << i }
140
+ end.to raise_exception(Errno::ELOOP)
141
+ end
135
142
  end
136
143
  end
137
144
 
@@ -41,6 +41,7 @@ RSpec.configure do |c|
41
41
  end
42
42
 
43
43
  SimpleCov.start do
44
+ add_filter 'lib/RFC7159/parser.rb'
44
45
  add_filter 'vendor/'
45
46
  add_filter 'spec/'
46
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RFC7159
3
3
  version: !ruby/object:Gem::Version
4
- version: '7159.03'
4
+ version: '7159.04'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Urabe,