RFC7159 7159.03 → 7159.04
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RFC7159.gemspec +8 -2
- data/Rakefile +1 -0
- data/lib/RFC7159/dumper.rb +2 -2
- data/lib/RFC7159/version.rb +1 -3
- data/spec/RFC7159_spec.rb +7 -0
- data/spec/spec_helper.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cde0201e044e37ab14b2426a4211058753632042
|
4
|
+
data.tar.gz: 19b26b85d1f3f455b8dee3b591c403c729f88ed9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54d23d27b59f817e73fe5da58b35f59ca86f1f4cee5527221c9831efbaf6a606427f8783a63df4d268a1793c14734661420442132cd11acb075111f4cef73687
|
7
|
+
data.tar.gz: 6ef984c3d3b5569fb5c2c9dbc708b714c2d9678f77be69b3023c31be5a82a0bfb5036c9fe4aa2cfff483e4782b6a3f6eee3054b5953f06691154b51aa6108043
|
data/RFC7159.gemspec
CHANGED
@@ -33,11 +33,17 @@
|
|
33
33
|
|
34
34
|
# coding: utf-8
|
35
35
|
|
36
|
-
|
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 =
|
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
|
data/lib/RFC7159/dumper.rb
CHANGED
@@ -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
|
114
|
-
raise Errno::ELOOP, "target appears twice: #{
|
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
|
data/lib/RFC7159/version.rb
CHANGED
@@ -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.
|
35
|
+
RFC7159::VERSION = 7159.04
|
38
36
|
|
39
37
|
#
|
40
38
|
# Local Variables:
|
data/spec/RFC7159_spec.rb
CHANGED
@@ -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
|
|
data/spec/spec_helper.rb
CHANGED