rubygem-aruba/aruba-pr914-ruby33.patch
2023-12-27 16:37:14 +09:00

140 lines
5.6 KiB
Diff

From bdf5edee50d6fda19a05147d1269370340b642c4 Mon Sep 17 00:00:00 2001
From: Matijs van Zuijlen <matijs@matijs.net>
Date: Fri, 8 Dec 2023 16:10:57 +0100
Subject: [PATCH 2/4] Use plain irb in debugging scenario
In Ruby 3.3, requiring readline does not load the real readline library
but falls back to reline by default. This creates odd output when the
terminal is not a real TTY and a prompt is used when getting input.
Because pry uses a prompt, this makes the interactive debugging scenario
fail.
This change works around this issue by switching to irb. Irb will not
use a prompt, possibly because the output is not a TTY.
See https://github.com/cucumber/aruba/issues/910. Also, see
https://github.com/ruby/reline/issues/616 for the resulting reline
issue.
---
.../command/debug_your_command_in_aruba.feature | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/features/03_testing_frameworks/cucumber/steps/command/debug_your_command_in_aruba.feature b/features/03_testing_frameworks/cucumber/steps/command/debug_your_command_in_aruba.feature
index 1c7bbc1cd..7a0f2785f 100644
--- a/features/03_testing_frameworks/cucumber/steps/command/debug_your_command_in_aruba.feature
+++ b/features/03_testing_frameworks/cucumber/steps/command/debug_your_command_in_aruba.feature
@@ -10,19 +10,15 @@ Feature: Debug your command in cucumber-test-run
Scenario: You can use a debug repl in your cli program
If you want to debug an error, which only occurs in one of your
- `cucumber`-tests, the `@debug`-tag becomes handy. This will use the
+ Cucumber tests, the `@debug`-tag becomes handy. This will use the
DebugProcess runner, making your program use the default stdin, stdout and
stderr streams so you can interact with it directly.
- This will, for example, make `binding.pry` and `byebug` work in your
+ This will, for example, make `binding.irb` and `byebug` work in your
program. However, Aruba steps that access the input and output of your
program will not work.
- Please make sure, that there's a statement after the `binding.pry`-call.
- Otherwise you might not get an interactive shell, because your program will
- just exit.
-
- We are going to demonstrate this using `pry`, but any other interactive
+ We are going to demonstrate this using `irb`, but any other interactive
debugger for any other programming language should also work.
Given an executable named "bin/aruba-test-cli" with:
@@ -27,8 +27,7 @@ Feature: Debug your command in cucumber-test-run
foo = 'hello'
- require 'pry'
- binding.pry
+ binding.irb
exit 0
"""
@@ -44,9 +43,9 @@ Feature: Debug your command in cucumber-test-run
And I type "exit"
Then the output should contain:
"""
- [1] pry(main)> foo
- => "hello"
- [2] pry(main)> exit
+ foo
+ "hello"
+ exit
"""
Scenario: Can handle announcers
From 2837d30ca5c32c7dca9333242fe8da7db6f8e753 Mon Sep 17 00:00:00 2001
From: Matijs van Zuijlen <matijs@matijs.net>
Date: Sun, 24 Dec 2023 08:15:31 +0100
Subject: [PATCH 3/4] Stop requiring 'irb/ext/save-history' extension in Aruba
console
See https://github.com/ruby/irb/pull/623. The file was removed and the
corresponding feature should be activated by setting :EVAL_HISTORY.
---
lib/aruba/console.rb | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/aruba/console.rb b/lib/aruba/console.rb
index ba8c680c1..3bd200ce5 100644
--- a/lib/aruba/console.rb
+++ b/lib/aruba/console.rb
@@ -29,7 +29,6 @@ def start
IRB.conf[:RC] = false
require "irb/completion"
- require "irb/ext/save-history"
IRB.conf[:READLINE] = true
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = Aruba.config.console_history_file
From fd45d9e794ee880bf8c9f750ad6b7b3bbcaee400 Mon Sep 17 00:00:00 2001
From: Matijs van Zuijlen <matijs@matijs.net>
Date: Sun, 24 Dec 2023 09:19:34 +0100
Subject: [PATCH 4/4] Ensure irb uses a consistent prompt format in tests on
all Ruby versions
The default prompt format for irb changed in Ruby 3.3. Using the classic
format instead ensures the same result is achieved in all Ruby versions.
---
.../steps/command/wait_for_output_of_command.feature | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/features/03_testing_frameworks/cucumber/steps/command/wait_for_output_of_command.feature b/features/03_testing_frameworks/cucumber/steps/command/wait_for_output_of_command.feature
index 0bf83f010..749d3f37a 100644
--- a/features/03_testing_frameworks/cucumber/steps/command/wait_for_output_of_command.feature
+++ b/features/03_testing_frameworks/cucumber/steps/command/wait_for_output_of_command.feature
@@ -12,7 +12,7 @@ Feature: Wait for output of commands
"""cucumber
Feature: Run command
Scenario: Run command
- When I run `irb --prompt default` interactively
+ When I run `irb --prompt classic` interactively
And I wait for output to contain "irb"
And I type "puts 6 + 5"
And I type "exit"
@@ -32,7 +32,7 @@ Feature: Wait for output of commands
"""cucumber
Feature: Run command
Scenario: Run command
- When I run `irb --prompt default` interactively
+ When I run `irb --prompt classic` interactively
And I wait for output to contain:
\"\"\"
irb(main):001:0>
@@ -49,7 +49,7 @@ Feature: Wait for output of commands
"""cucumber
Feature: Run command
Scenario: Run command
- When I run `irb --prompt default` interactively
+ When I run `irb --prompt classic` interactively
And I wait for output to contain:
\"\"\"
irb(main):001:0>