File: 0007-Make-tests-support-also-ruby3.0.patch

package info (click to toggle)
pry 0.13.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,760 kB
  • sloc: ruby: 21,552; sh: 17; makefile: 10
file content (47 lines) | stat: -rw-r--r-- 1,511 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From: Lucas Kanashiro <kanashiro@ubuntu.com>
Date: Mon, 25 Oct 2021 15:55:17 -0300
Subject: Make tests support also ruby3.0

This patch allows test execution with both, ruby2.7 and ruby3.0.

Origin: backport, https://github.com/pry/pry/commit/25f5022fcf3c43c43bfdb
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996118
---
 spec/syntax_checking_spec.rb | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/spec/syntax_checking_spec.rb b/spec/syntax_checking_spec.rb
index ca75ba9..b3083e2 100644
--- a/spec/syntax_checking_spec.rb
+++ b/spec/syntax_checking_spec.rb
@@ -23,7 +23,7 @@ describe Pry do
     end
   end
 
-  [
+  array = [
     ["end"],
     ["puts )("],
     ["1 1"],
@@ -33,11 +33,17 @@ describe Pry do
     ["def", "method(1"],
 
     # in this case the syntax error is "expecting keyword_end".
-    ["o = Object.new.tap{ def o.render;", "'MEH'", "}"],
-
+    ["o = Object.new.tap{ def o.render;", "'MEH'", "}"]
+  ]
+  if RbConfig::CONFIG['ruby_version'] == '2.7.0'
+    # multiple syntax errors reported in one SyntaxException
+    array << ["puts {'key'=>'val'}.to_json"]
+  else
     # multiple syntax errors reported in one SyntaxException
-    ["puts {'key'=>'val'}.to_json"]
-  ].compact.each do |foo|
+    array << ["puts {key: 'val'}.to_json"]
+  end
+
+  array.compact.each do |foo|
     it "should raise an error on invalid syntax like #{foo.inspect}" do
       redirect_pry_io(InputTester.new(*foo), @str_output) do
         Pry.start