diff --git a/lib/method_source/code_helpers.rb b/lib/method_source/code_helpers.rb index 4185c18..211e123 100644 --- a/lib/method_source/code_helpers.rb +++ b/lib/method_source/code_helpers.rb @@ -127,6 +127,7 @@ module IncompleteExpression /embedded document meets end of file/, # =begin /unterminated (quoted string|string|regexp|list) meets end of file/, # "quoted string" is ironruby /can't find string ".*" anywhere before EOF/, # rbx and jruby + /expected a closing delimiter for the `%x` or backtick string/, # prism /missing 'end' for/, /expecting kWHEN/ # rbx ] diff --git a/spec/method_source/code_helpers_spec.rb b/spec/method_source/code_helpers_spec.rb index 287ff89..e6115c2 100644 --- a/spec/method_source/code_helpers_spec.rb +++ b/spec/method_source/code_helpers_spec.rb @@ -5,6 +5,11 @@ @tester = Object.new.extend(MethodSource::CodeHelpers) end + it "recognizes incomplete command-string delimiters" do + expect(@tester.complete_expression?("%x[word")).to be_falsy + expect(@tester.complete_expression?("`word")).to be_falsy + end + [ ["p = '", "'"], ["def", "a", "(); end"],