From 03f478d360eb90ef7fb8912a657d8f3590a491bd Mon Sep 17 00:00:00 2001 From: ksss Date: Tue, 4 Feb 2025 23:48:10 +0900 Subject: [PATCH 1/4] Split file for current raap test --- Rakefile | 3 ++- test/raap/core.rb | 11 +++++++++++ test/{raap.rb => raap/digest.rb} | 17 +++++++++++------ 3 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 test/raap/core.rb rename test/{raap.rb => raap/digest.rb} (66%) diff --git a/Rakefile b/Rakefile index 908555fa8..24ca52119 100644 --- a/Rakefile +++ b/Rakefile @@ -139,7 +139,8 @@ task :typecheck_test => :compile do end task :raap => :compile do - sh %q[ruby test/raap.rb | xargs bundle exec raap -r digest/bubblebabble --library digest --allow-private] + sh "ruby test/raap/core.rb" + sh "ruby test/raap/digest.rb" end task :rubocop do diff --git a/test/raap/core.rb b/test/raap/core.rb new file mode 100644 index 000000000..49f645486 --- /dev/null +++ b/test/raap/core.rb @@ -0,0 +1,11 @@ +require 'raap' + +argv = [ + '--size-by', '2', + '--allow-private' +] + +argv << 'Set[Integer]' +argv << 'Enumerable[Integer]#to_set' + +RaaP::CLI.new(argv).load.run diff --git a/test/raap.rb b/test/raap/digest.rb similarity index 66% rename from test/raap.rb rename to test/raap/digest.rb index 1456a9410..d33f4889c 100644 --- a/test/raap.rb +++ b/test/raap/digest.rb @@ -1,8 +1,11 @@ -# Specify the class/module and method names to be executed by RaaP. -# By prefixing with `!`, you can skip testing a method. +require 'raap' -puts 'Set[Integer]' -puts 'Enumerable[Integer]#to_set' +argv = [ + '-r', 'digest/bubblebabble', + '--library', 'digest', + '--size-by', '2', + '--allow-private' +] %w[ MD5 @@ -18,7 +21,7 @@ digest hexdigest ].each do |singleton_method| - puts "Digest::#{klass}.#{singleton_method}" + argv << "Digest::#{klass}.#{singleton_method}" end %w[ @@ -47,6 +50,8 @@ finish initialize_copy ].each do |instance_method| - puts "Digest::#{klass}##{instance_method}" + argv << "Digest::#{klass}##{instance_method}" end end + +RaaP::CLI.new(argv).load.run From 59bb8ca2f42bcfbd8d0c30d2b7308232b7cd01d1 Mon Sep 17 00:00:00 2001 From: ksss Date: Wed, 5 Feb 2025 09:24:59 +0900 Subject: [PATCH 2/4] Update raap --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 83608be8f..956ea458f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,7 +77,7 @@ GEM psych (4.0.6) stringio public_suffix (6.0.1) - raap (1.1.0) + raap (1.2.0) rbs (~> 3.0) timeout (~> 0.4) racc (1.8.1) From 92ffbc4b75825fc59e44b8b32ffaf41a7465051c Mon Sep 17 00:00:00 2001 From: ksss Date: Wed, 5 Feb 2025 09:25:10 +0900 Subject: [PATCH 3/4] Fix OpenSSL::BN methods Arguments with the following characteristics have been modified to use `bn`. - Cannot allow _ToInt - Can allow OpenSSL::BN Also, the test is now managed by RaaP. --- stdlib/openssl/0/openssl.rbs | 32 ++++++++++++++++---------------- test/raap/openssl.rb | 36 ++++++++++++++++++++++++++++++++++++ test/stdlib/OpenSSL_test.rb | 36 +++++++++++++++++++----------------- 3 files changed, 71 insertions(+), 33 deletions(-) create mode 100644 test/raap/openssl.rb diff --git a/stdlib/openssl/0/openssl.rbs b/stdlib/openssl/0/openssl.rbs index 2b3e52f6d..416d2d0b5 100644 --- a/stdlib/openssl/0/openssl.rbs +++ b/stdlib/openssl/0/openssl.rbs @@ -1527,28 +1527,28 @@ module OpenSSL # - bn % bn2 => aBN # --> # - def %: (int) -> instance + def %: (bn) -> instance # # - def *: (int) -> instance + def *: (bn) -> instance # # - def **: (int) -> instance + def **: (bn) -> instance # # - def +: (int) -> instance + def +: (bn) -> instance # # - def -: (int) -> instance + def -: (bn) -> instance # # Division of OpenSSL::BN instances # - def /: (int) -> [ instance, instance ] + def /: (bn) -> [ instance, instance ] # # - def cmp: (Integer) -> Integer + def cmp: (bn) -> Integer # # - def copy: (int) -> instance + def copy: (bn) -> instance # # - def gcd: (int) -> instance + def gcd: (bn) -> instance # # - def mod_add: (int, int) -> instance + def mod_add: (bn, bn) -> instance # # - def mod_exp: (int, int) -> instance + def mod_exp: (bn, bn) -> instance # # - def mod_inverse: (int) -> instance + def mod_inverse: (bn) -> instance # # - def mod_mul: (int, int) -> instance + def mod_mul: (bn, bn) -> instance # # - def mod_sqr: (int) -> instance + def mod_sqr: (bn) -> instance # # - def mod_sub: (int, int) -> instance + def mod_sub: (bn, bn) -> instance # # - def ucmp: (int bn2) -> ::Integer + def ucmp: (bn bn2) -> ::Integer #