Skip to content

Commit 6ff9f8d

Browse files
committed
Add pending spec for over-escaped multibyte source
Some customers have code with escaped multibyte characters in regular expressions. This causes the engine to error because File.read doubly-escapes it, which fails to parse. The escaping these customers have is not needed. They can remove their backslash and all should work fine. That's what we're prescribing for now via customer services, since all other options are too time-consuming. Eventually, we would like to support this code as-is (as we do any realistic source files customers may have) -- when/if we do, this spec will pass.
1 parent dfdc557 commit 6ff9f8d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spec/cc/engine/analyzers/ruby/main_spec.rb

+13
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ module CC::Engine::Analyzers
88
include AnalyzerSpecHelpers
99

1010
describe "#run" do
11+
it "handles escaped multibyte characters in regular expressions" do
12+
create_source_file("foo.rb", <<-EORUBY)
13+
class Helper
14+
def self.sub_degrees(str)
15+
str.gsub(/\\d+\\°\\s/, "")
16+
end
17+
end
18+
EORUBY
19+
20+
pending "Potential lexing bug. Ask customer to remove escaping."
21+
run_engine(engine_conf).strip.split("\0")
22+
end
23+
1124
it "prints an issue" do
1225
create_source_file("foo.rb", <<-EORUBY)
1326
describe '#ruby?' do

0 commit comments

Comments
 (0)