diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2023-10-10 15:22:29 -0400 |
|---|---|---|
| committer | Kevin Newton <kddnewton@gmail.com> | 2023-10-13 15:31:30 -0400 |
| commit | ef1e5b65dc14e1b76265eb9792545da2d9f3aa23 (patch) | |
| tree | 5362a25ede811f78cb6565ce4aafa3b00b60cf67 /test | |
| parent | f64a0434dd215dbefa8c38e8768c68ea431e8d01 (diff) | |
[ruby/prism] Use current_string to handle escapes in string literals
https://github.com/ruby/prism/commit/d912d48104
Diffstat (limited to 'test')
| -rw-r--r-- | test/prism/snapshots/seattlerb/qw_escape.txt | 2 | ||||
| -rw-r--r-- | test/prism/snapshots/seattlerb/qw_escape_term.txt | 2 | ||||
| -rw-r--r-- | test/prism/snapshots/spanning_heredoc.txt | 26 | ||||
| -rw-r--r-- | test/prism/unescape_test.rb | 10 |
4 files changed, 20 insertions, 20 deletions
diff --git a/test/prism/snapshots/seattlerb/qw_escape.txt b/test/prism/snapshots/seattlerb/qw_escape.txt index ef60ee32c4..d92c1da7a6 100644 --- a/test/prism/snapshots/seattlerb/qw_escape.txt +++ b/test/prism/snapshots/seattlerb/qw_escape.txt @@ -8,4 +8,4 @@ ├── opening_loc: (1,0)-(1,3) = "%q(" ├── content_loc: (1,3)-(1,6) = "\u0001\\'" ├── closing_loc: (1,6)-(1,7) = ")" - └── unescaped: "\u0001'" + └── unescaped: "\u0001\\'" diff --git a/test/prism/snapshots/seattlerb/qw_escape_term.txt b/test/prism/snapshots/seattlerb/qw_escape_term.txt index 0677055ad6..e935b7eb68 100644 --- a/test/prism/snapshots/seattlerb/qw_escape_term.txt +++ b/test/prism/snapshots/seattlerb/qw_escape_term.txt @@ -8,4 +8,4 @@ ├── opening_loc: (1,0)-(1,3) = "%q|" ├── content_loc: (1,3)-(1,25) = "blah blah \\| blah blah" ├── closing_loc: (1,25)-(1,26) = "|" - └── unescaped: "blah blah \\| blah blah" + └── unescaped: "blah blah | blah blah" diff --git a/test/prism/snapshots/spanning_heredoc.txt b/test/prism/snapshots/spanning_heredoc.txt index 884028f054..2c59cb4368 100644 --- a/test/prism/snapshots/spanning_heredoc.txt +++ b/test/prism/snapshots/spanning_heredoc.txt @@ -73,10 +73,10 @@ │ │ └── @ InterpolatedStringNode (location: (10,9)-(13,2)) │ │ ├── opening_loc: (10,9)-(10,10) = "\"" │ │ ├── parts: (length: 2) - │ │ │ ├── @ StringNode (location: (10,10)-(10,0)) + │ │ │ ├── @ StringNode (location: (10,10)-(10,12)) │ │ │ │ ├── flags: ∅ │ │ │ │ ├── opening_loc: ∅ - │ │ │ │ ├── content_loc: (10,10)-(10,0) = "d\\\n" + │ │ │ │ ├── content_loc: (10,10)-(10,12) = "d\\" │ │ │ │ ├── closing_loc: ∅ │ │ │ │ └── unescaped: "d" │ │ │ └── @ StringNode (location: (13,0)-(13,1)) @@ -107,10 +107,10 @@ │ │ └── @ InterpolatedStringNode (location: (16,9)-(19,2)) │ │ ├── opening_loc: (16,9)-(16,12) = "%q[" │ │ ├── parts: (length: 2) - │ │ │ ├── @ StringNode (location: (16,12)-(16,0)) + │ │ │ ├── @ StringNode (location: (16,12)-(16,14)) │ │ │ │ ├── flags: ∅ │ │ │ │ ├── opening_loc: ∅ - │ │ │ │ ├── content_loc: (16,12)-(16,0) = "f\\\n" + │ │ │ │ ├── content_loc: (16,12)-(16,14) = "f\\" │ │ │ │ ├── closing_loc: ∅ │ │ │ │ └── unescaped: "f\\\n" │ │ │ └── @ StringNode (location: (19,0)-(19,1)) @@ -141,10 +141,10 @@ │ │ └── @ InterpolatedStringNode (location: (22,9)-(25,2)) │ │ ├── opening_loc: (22,9)-(22,12) = "%Q[" │ │ ├── parts: (length: 2) - │ │ │ ├── @ StringNode (location: (22,12)-(22,0)) + │ │ │ ├── @ StringNode (location: (22,12)-(22,14)) │ │ │ │ ├── flags: ∅ │ │ │ │ ├── opening_loc: ∅ - │ │ │ │ ├── content_loc: (22,12)-(22,0) = "h\\\n" + │ │ │ │ ├── content_loc: (22,12)-(22,14) = "h\\" │ │ │ │ ├── closing_loc: ∅ │ │ │ │ └── unescaped: "h" │ │ │ └── @ StringNode (location: (25,0)-(25,1)) @@ -179,7 +179,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── content_loc: (28,12)-(28,14) = "j\\" │ │ │ │ ├── closing_loc: ∅ - │ │ │ │ └── unescaped: "j" + │ │ │ │ └── unescaped: "j\n" │ │ │ └── @ StringNode (location: (31,0)-(31,1)) │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: ∅ @@ -216,7 +216,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── content_loc: (35,12)-(35,14) = "l\\" │ │ │ │ │ ├── closing_loc: ∅ - │ │ │ │ │ └── unescaped: "l" + │ │ │ │ │ └── unescaped: "l\n" │ │ │ │ └── @ StringNode (location: (38,0)-(38,1)) │ │ │ │ ├── flags: ∅ │ │ │ │ ├── opening_loc: ∅ @@ -250,7 +250,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── value_loc: (41,12)-(41,14) = "n\\" │ │ │ │ ├── closing_loc: ∅ - │ │ │ │ └── unescaped: "n" + │ │ │ │ └── unescaped: "n\n" │ │ │ └── @ SymbolNode (location: (44,0)-(44,1)) │ │ │ ├── opening_loc: ∅ │ │ │ ├── value_loc: (44,0)-(44,1) = "n" @@ -278,18 +278,18 @@ │ │ └── unescaped: "o\n" │ └── @ ArrayNode (location: (48,9)-(51,2)) │ ├── elements: (length: 1) - │ │ └── @ InterpolatedSymbolNode (location: (48,12)-(51,1)) + │ │ └── @ InterpolatedSymbolNode (location: (48,12)-(48,14)) │ │ ├── opening_loc: ∅ │ │ ├── parts: (length: 2) │ │ │ ├── @ SymbolNode (location: (48,12)-(48,14)) │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── value_loc: (48,12)-(48,14) = "p\\" │ │ │ │ ├── closing_loc: ∅ - │ │ │ │ └── unescaped: "p" - │ │ │ └── @ StringNode (location: (51,0)-(51,1)) + │ │ │ │ └── unescaped: "p\n" + │ │ │ └── @ StringNode (location: (48,12)-(48,14)) │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: ∅ - │ │ │ ├── content_loc: (51,0)-(51,1) = "p" + │ │ │ ├── content_loc: (48,12)-(48,14) = "p\\" │ │ │ ├── closing_loc: ∅ │ │ │ └── unescaped: "p" │ │ └── closing_loc: ∅ diff --git a/test/prism/unescape_test.rb b/test/prism/unescape_test.rb index 0053fdd364..95b3675e2e 100644 --- a/test/prism/unescape_test.rb +++ b/test/prism/unescape_test.rb @@ -95,11 +95,11 @@ module Prism contexts = [ [Context::String.new("?", ""), escapes], - # [Context::String.new("'", "'"), escapes], - # [Context::String.new("\"", "\""), escapes], - # [Context::String.new("%q[", "]"), escapes], - # [Context::String.new("%Q[", "]"), escapes], - # [Context::String.new("%[", "]"), escapes], + [Context::String.new("'", "'"), escapes], + [Context::String.new("\"", "\""), escapes], + [Context::String.new("%q[", "]"), escapes], + [Context::String.new("%Q[", "]"), escapes], + [Context::String.new("%[", "]"), escapes], # [Context::String.new("`", "`"), escapes], # [Context::String.new("<<~H\n", "\nH"), escapes], # [Context::String.new("<<~'H'\n", "\nH"), escapes], |
