summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/prism/snapshots/dos_endings.txt2
-rw-r--r--test/prism/snapshots/spanning_heredoc.txt2
-rw-r--r--test/prism/snapshots/whitequark/parser_slash_slash_n_escaping_in_literals.txt2
-rw-r--r--test/prism/unescape_test.rb6
4 files changed, 7 insertions, 5 deletions
diff --git a/test/prism/snapshots/dos_endings.txt b/test/prism/snapshots/dos_endings.txt
index 73390ffad1..d01c5a7ac9 100644
--- a/test/prism/snapshots/dos_endings.txt
+++ b/test/prism/snapshots/dos_endings.txt
@@ -36,7 +36,7 @@
│ │ ├── opening_loc: ∅
│ │ ├── value_loc: (4,3)-(5,1) = "a\\\r\nb"
│ │ ├── closing_loc: ∅
- │ │ └── unescaped: "ab"
+ │ │ └── unescaped: "a\nb"
│ ├── opening_loc: (4,0)-(4,3) = "%I{"
│ └── closing_loc: (5,1)-(5,2) = "}"
├── @ StringNode (location: (7,0)-(7,4))
diff --git a/test/prism/snapshots/spanning_heredoc.txt b/test/prism/snapshots/spanning_heredoc.txt
index cb99a343ab..884028f054 100644
--- a/test/prism/snapshots/spanning_heredoc.txt
+++ b/test/prism/snapshots/spanning_heredoc.txt
@@ -285,7 +285,7 @@
│ │ │ │ ├── opening_loc: ∅
│ │ │ │ ├── value_loc: (48,12)-(48,14) = "p\\"
│ │ │ │ ├── closing_loc: ∅
- │ │ │ │ └── unescaped: "p\\"
+ │ │ │ │ └── unescaped: "p"
│ │ │ └── @ StringNode (location: (51,0)-(51,1))
│ │ │ ├── flags: ∅
│ │ │ ├── opening_loc: ∅
diff --git a/test/prism/snapshots/whitequark/parser_slash_slash_n_escaping_in_literals.txt b/test/prism/snapshots/whitequark/parser_slash_slash_n_escaping_in_literals.txt
index 2de7dd439c..20496c3cfc 100644
--- a/test/prism/snapshots/whitequark/parser_slash_slash_n_escaping_in_literals.txt
+++ b/test/prism/snapshots/whitequark/parser_slash_slash_n_escaping_in_literals.txt
@@ -15,7 +15,7 @@
│ │ ├── opening_loc: ∅
│ │ ├── value_loc: (4,3)-(5,1) = "a\\\nb"
│ │ ├── closing_loc: ∅
- │ │ └── unescaped: "ab"
+ │ │ └── unescaped: "a\nb"
│ ├── opening_loc: (4,0)-(4,3) = "%I{"
│ └── closing_loc: (5,1)-(5,2) = "}"
├── @ StringNode (location: (7,0)-(8,2))
diff --git a/test/prism/unescape_test.rb b/test/prism/unescape_test.rb
index 4104b051dd..0053fdd364 100644
--- a/test/prism/unescape_test.rb
+++ b/test/prism/unescape_test.rb
@@ -75,6 +75,7 @@ module Prism
ascii = (0...128).map(&:chr)
ascii8 = (128...256).map(&:chr)
+ newlines = ["\r\n"]
octal = [*("0".."7")]
octal = octal.product(octal).map(&:join).concat(octal.product(octal).product(octal).map(&:join))
@@ -90,7 +91,8 @@ module Prism
ctrls = (ascii.grep(/[[:print:]]/) - ["\\"]).flat_map { |c| ["C-#{c}", "c#{c}", "M-#{c}", "M-\\C-#{c}", "M-\\c#{c}", "c\\M-#{c}"] }
- escapes = [*ascii, *ascii8, *octal, *hex2, *hex4, *hex6, *ctrls]
+ escapes = [*ascii, *ascii8, *newlines, *octal, *hex2, *hex4, *hex6, *ctrls]
+
contexts = [
[Context::String.new("?", ""), escapes],
# [Context::String.new("'", "'"), escapes],
@@ -106,7 +108,7 @@ module Prism
[Context::List.new("%w[", "]"), escapes],
[Context::List.new("%W[", "]"), escapes],
[Context::List.new("%i[", "]"), escapes],
- # [Context::List.new("%I[", "]"), escapes],
+ [Context::List.new("%I[", "]"), escapes],
# [Context::Symbol.new("%s[", "]"), escapes],
# [Context::Symbol.new(":'", "'"), escapes],
# [Context::Symbol.new(":\"", "\""), escapes],