From 7413c52e0f6dca97c1d21e2daaea040c83eb46cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janosch=20Mu=CC=88ller?= Date: Sun, 14 May 2023 12:13:03 +0200 Subject: [PATCH] Spec https://bugs.ruby-lang.org/issues/19639 --- spec/scanner/escapes_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/scanner/escapes_spec.rb b/spec/scanner/escapes_spec.rb index 1d70a29..2b325d7 100644 --- a/spec/scanner/escapes_spec.rb +++ b/spec/scanner/escapes_spec.rb @@ -43,6 +43,14 @@ include_examples 'scan', 'ab\$cd', 1 => [:escape, :eol, '\$', 2, 4] include_examples 'scan', 'ab\[cd', 1 => [:escape, :set_open, '\[', 2, 4] + # escaped whitespace in x-mode + include_examples 'scan', /a\ b/x, 0 => [:literal, :literal, 'a', 0, 1], + 1 => [:escape, :literal, '\ ', 1, 3], + 2 => [:literal, :literal, 'b', 3, 4] + # newline literals can't be escaped in x-mode, c.f. https://bugs.ruby-lang.org/issues/19639 + include_examples 'scan', /a\ +b/x, 0 => [:literal, :literal, 'ab', 0, 2] + # Meta/control espaces # # After the following fix in Ruby 3.1, a Regexp#source containing meta/control