From 17a931ab65b5a8bfe4e801a5faafbd1d9d5d5ede Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 10 Nov 2020 12:14:14 +0900 Subject: Complex and Rational is embedded classes now --- lib/json/add/complex.rb | 1 - lib/json/add/rational.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/json/add/complex.rb b/lib/json/add/complex.rb index 4d977e7..e63e29f 100644 --- a/lib/json/add/complex.rb +++ b/lib/json/add/complex.rb @@ -2,7 +2,6 @@ unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end -defined?(::Complex) or require 'complex' class Complex diff --git a/lib/json/add/rational.rb b/lib/json/add/rational.rb index 6be4034..f776226 100644 --- a/lib/json/add/rational.rb +++ b/lib/json/add/rational.rb @@ -2,7 +2,6 @@ unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end -defined?(::Rational) or require 'rational' class Rational # Deserializes JSON string by converting numerator value n, -- cgit v1.2.1 From ca6c13549e444939233e0bf48d06eea51c136bd8 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 20 Oct 2020 23:52:03 +0900 Subject: strip trailing spaces [ci skip] --- tests/json_parser_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/json_parser_test.rb b/tests/json_parser_test.rb index e29f3f1..c7f1a5f 100644 --- a/tests/json_parser_test.rb +++ b/tests/json_parser_test.rb @@ -222,7 +222,7 @@ class JSONParserTest < Test::Unit::TestCase assert_predicate parse('{}', :freeze => true), :frozen? assert_predicate parse('[]', :freeze => true), :frozen? assert_predicate parse('"foo"', :freeze => true), :frozen? - + if string_deduplication_available? assert_same -'foo', parse('"foo"', :freeze => true) assert_same -'foo', parse('{"foo": 1}', :freeze => true).keys.first -- cgit v1.2.1 From c03f39ab4c8541de88408dfc2f272487cb2f31f5 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Wed, 21 Oct 2020 23:36:49 +0900 Subject: test/json/json_parser_test.rb: suppress warnings http://rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20201021T123003Z.log.html.gz ``` /home/chkbuild/chkbuild/tmp/build/20201021T123003Z/ruby/test/json/json_parser_test.rb:227: warning: ambiguous first argument; put parentheses or a space even after `-' operator /home/chkbuild/chkbuild/tmp/build/20201021T123003Z/ruby/test/json/json_parser_test.rb:228: warning: ambiguous first argument; put parentheses or a space even after `-' operator ``` --- tests/json_parser_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/json_parser_test.rb b/tests/json_parser_test.rb index c7f1a5f..dce693e 100644 --- a/tests/json_parser_test.rb +++ b/tests/json_parser_test.rb @@ -224,8 +224,8 @@ class JSONParserTest < Test::Unit::TestCase assert_predicate parse('"foo"', :freeze => true), :frozen? if string_deduplication_available? - assert_same -'foo', parse('"foo"', :freeze => true) - assert_same -'foo', parse('{"foo": 1}', :freeze => true).keys.first + assert_same(-'foo', parse('"foo"', :freeze => true)) + assert_same(-'foo', parse('{"foo": 1}', :freeze => true).keys.first) end end -- cgit v1.2.1 From 6a97ad2795d1aa2d5c36b980d40d5b92a52061e1 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Mon, 28 Sep 2020 23:06:50 +0900 Subject: Remove unnecessary executable bit [ci skip] --- tests/json_generator_test.rb | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 tests/json_generator_test.rb diff --git a/tests/json_generator_test.rb b/tests/json_generator_test.rb old mode 100755 new mode 100644 -- cgit v1.2.1 From 1172b6e2185e95caf577df8aa213d6740569d274 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 25 Sep 2020 15:40:56 +0900 Subject: assert_true is not provided by test-unit --- tests/json_common_interface_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/json_common_interface_test.rb b/tests/json_common_interface_test.rb index 4fdc2b1..6939d4b 100644 --- a/tests/json_common_interface_test.rb +++ b/tests/json_common_interface_test.rb @@ -152,7 +152,7 @@ class JSONCommonInterfaceTest < Test::Unit::TestCase temp_file_containing(@json) do |filespec| parsed_object = JSON.public_send(method_name, filespec, symbolize_names: true) key_classes = parsed_object.keys.map(&:class) - assert_true key_classes.include?(Symbol) && (! key_classes.include?(String)) + assert key_classes.include?(Symbol) && (! key_classes.include?(String)) end end -- cgit v1.2.1 From 934e43323856431ceba4a6078a87a03140baa7e2 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 25 Sep 2020 20:28:31 +0900 Subject: Extract assert assertion to assert_include and assert_not_include. --- tests/json_common_interface_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/json_common_interface_test.rb b/tests/json_common_interface_test.rb index 6939d4b..faa908e 100644 --- a/tests/json_common_interface_test.rb +++ b/tests/json_common_interface_test.rb @@ -152,7 +152,8 @@ class JSONCommonInterfaceTest < Test::Unit::TestCase temp_file_containing(@json) do |filespec| parsed_object = JSON.public_send(method_name, filespec, symbolize_names: true) key_classes = parsed_object.keys.map(&:class) - assert key_classes.include?(Symbol) && (! key_classes.include?(String)) + assert_include(key_classes, Symbol) + assert_not_include(key_classes, String) end end -- cgit v1.2.1 From cd2e02c2115a5c0e25eaf59db53333fa7a68fbf9 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Wed, 30 Sep 2020 15:41:14 +0900 Subject: Fix `Leaked tempfile`s http://rubyci.s3.amazonaws.com/debian10/ruby-master/log/20200930T033004Z.diff.html.gz ``` [n/n] JSONCommonInterfaceTest#test_load = s [n/n] JSONCommonInterfaceTest#test_load_file = s +Leaked tempfile: JSONCommonInterfaceTest#test_load_file: #/tmp/20200930-7601-ptnv6i (closed)> [n/n] JSONCommonInterfaceTest#test_load_file! = s +Leaked tempfile: JSONCommonInterfaceTest#test_load_file!: #/tmp/20200930-7601-1la6m9 (closed)> [n/n] JSONCommonInterfaceTest#test_load_file_with_option = s +Leaked tempfile: JSONCommonInterfaceTest#test_load_file_with_option: #/tmp/20200930-7601-blf9hz (closed)> [n/n] JSONCommonInterfaceTest#test_load_file_with_option! = s +Leaked tempfile: JSONCommonInterfaceTest#test_load_file_with_option!: #/tmp/20200930-7601-b5gsdb (closed)> ``` --- tests/json_common_interface_test.rb | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/tests/json_common_interface_test.rb b/tests/json_common_interface_test.rb index faa908e..68ad756 100644 --- a/tests/json_common_interface_test.rb +++ b/tests/json_common_interface_test.rb @@ -157,27 +157,15 @@ class JSONCommonInterfaceTest < Test::Unit::TestCase end end - # Copied and slightly modified from https://github.com/keithrbennett/trick_bag - # (https://github.com/keithrbennett/trick_bag/blob/master/lib/trick_bag/io/temp_files.rb). - # - # For the easy creation and deletion of a temp file populated with text, - # wrapped around the code block you provide. - # - # @param text the text to write to the temporary file - # @param file_prefix optional prefix for the temporary file's name - # @yield filespec of the temporary file def temp_file_containing(text, file_prefix = '') raise "This method must be called with a code block." unless block_given? - filespec = nil begin - Tempfile.open(file_prefix) do |file| + Tempfile.create(file_prefix) do |file| file << text - filespec = file.path + file.close + yield file.path end - yield(filespec) - ensure - File.delete(filespec) if filespec && File.exist?(filespec) end end end -- cgit v1.2.1 From 939f641740ff66d62b3fcf7f798dfe997500e03e Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Wed, 30 Sep 2020 15:55:07 +0900 Subject: Remove unneeded `begin` and `end` --- tests/json_common_interface_test.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/json_common_interface_test.rb b/tests/json_common_interface_test.rb index 68ad756..8cf74b4 100644 --- a/tests/json_common_interface_test.rb +++ b/tests/json_common_interface_test.rb @@ -160,12 +160,10 @@ class JSONCommonInterfaceTest < Test::Unit::TestCase def temp_file_containing(text, file_prefix = '') raise "This method must be called with a code block." unless block_given? - begin - Tempfile.create(file_prefix) do |file| - file << text - file.close - yield file.path - end + Tempfile.create(file_prefix) do |file| + file << text + file.close + yield file.path end end end -- cgit v1.2.1 From dca43ea3b43f475869a4731aa3bc138be16a6e9e Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Fri, 25 Sep 2020 23:37:12 +0900 Subject: t/json/json_common_interface_test.rb: fix wrong indentation to prevent: ``` test/json/json_common_interface_test.rb:182: warning: mismatched indentations at 'end' with 'def' at 169 ``` --- tests/json_common_interface_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/json_common_interface_test.rb b/tests/json_common_interface_test.rb index 8cf74b4..9148b78 100644 --- a/tests/json_common_interface_test.rb +++ b/tests/json_common_interface_test.rb @@ -165,5 +165,5 @@ class JSONCommonInterfaceTest < Test::Unit::TestCase file.close yield file.path end - end + end end -- cgit v1.2.1 From db91e90ac1375283f29e1f4a235cc7abb043c2f0 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 13 Nov 2020 11:04:56 +0900 Subject: Drop to support Ruby 2.0 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 78b19dd..0aaa2fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ language: ruby # Specify which ruby versions you wish to run your tests on, each version will be used rvm: - - 2.0.0 - 2.1 - 2.2 - 2.3 -- cgit v1.2.1