Regexes appear same, test !=

How can this occur?

This is output from an RSpec test…

   expected: /<(?<tag>([[:alpha:]])+)>(?<cdata>(.)*)<\/\k<tag>>/
             got: 

/<(?([[:alpha:]])+)>(?(.)*)</\k>/
(using ==)

Any clue what I’m missing here?

Thanks,
Hal

On Sep 24, 2013, at 11:26 , Hal F. [email protected] wrote:

How can this occur?

This is output from an RSpec test…

   expected: /<(?<tag>([[:alpha:]])+)>(?<cdata>(.)*)<\/\k<tag>>/
        got: /<(?<tag>([[:alpha:]])+)>(?<cdata>(.)*)<\/\k<tag>>/ (using ==)

check the encodings

This is why minitest says the following:

                  "No visible difference in the #{klass}#inspect 

output.\n",
"You should look at the implementation of #== on
",
“#{klass} or its members.\n”,

On Tue, Sep 24, 2013 at 11:26 AM, Hal F. [email protected]
wrote:

How can this occur?

This is output from an RSpec test…

   expected: /<(?<tag>([[:alpha:]])+)>(?<cdata>(.)*)<\/\k<tag>>/
             got: /<(?<tag>([[:alpha:]])+)>(?<cdata>(.)*)<\/\k<tag>>/

(using ==)

http://www.ruby-doc.org/core-1.9.3/Regexp.html#method-i-to_s

Gives a good clue == vs #to_s/#inspect (visual inspection) may produce
different results. So you probably want to use #to_s or #inspect and
then
test the strings.

John

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs