ruby/strscan

Tests failing because argument is String but expected Regexp

pyrmont opened this issue · 6 comments

I'd like to submit a PR fixing what I think is a bug in StringScanner but I haven't been able to get the test suite to pass when run from master.

When I run rake test on master (currently 4959c97), I get 1 failure and 5 errors. Below is a representative error:

[38/49] TestStringScanner#test_scan_string = 0.00 s
  6) Error:
TestStringScanner#test_scan_string:
TypeError: wrong argument type String (expected Regexp)
    /.../strscan/test/strscan/test_stringscanner.rb:287:in `scan'
    /.../strscan/test/strscan/test_stringscanner.rb:287:in `test_scan_string'

[...]

ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]

Based on the message, this seems to be caused by the recent change to allow patterns to be submitted as Strings. I would like to update the tests so as not to report this error, but I don't see where this test comes from and how to correct it.

Is anyone able to explain what I should change?

kou commented

Travis CI is green: https://travis-ci.org/ruby/strscan/builds

You need to run rake compile before rake test.
Or you can just run rake.

Hmmm... OK. The only thing I can think is that I have a local path set for bundler (/vendor). I don't see why but do you think that could be the cause?

I've now tried without installing to a local directory and the problem remains.

Weird. Travis works for me as well. I'm not sure what the problem is...

Found the problem. I was using a 1.17.2 release of Bundler. Tests all pass with Bundler 2.0.1.

Sorry for the trouble :(

kou commented

Good to know.