summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2009-02-05 23:45:16 +0000
committermurphy <murphy@rubychan.de>2009-02-05 23:45:16 +0000
commit1ee89811c7bf8fc124e318ca01a605d3dfff1589 (patch)
tree28bab3366e218d5164114f0903e4f0dabdf1f879 /test
parent7c653b9bafc2159431c86b628d5279913e7ec74d (diff)
downloadcoderay-1ee89811c7bf8fc124e318ca01a605d3dfff1589.tar.gz
Ruby scanner: Fixed rarely used \c, \C-, and \M- escape sequences.
* JavaScript scanner: elaborate a comment * SimpleRegexpScanner: Just some testing with the Ruby stack. * coderay-lib.tmproj: I should just remove it from the repo...
Diffstat (limited to 'test')
-rw-r--r--test/scanners/ruby/regexp.expected.raydebug15
-rw-r--r--test/scanners/ruby/regexp.in.rb15
2 files changed, 28 insertions, 2 deletions
diff --git a/test/scanners/ruby/regexp.expected.raydebug b/test/scanners/ruby/regexp.expected.raydebug
index 43f1d91..4d6086b 100644
--- a/test/scanners/ruby/regexp.expected.raydebug
+++ b/test/scanners/ruby/regexp.expected.raydebug
@@ -2,4 +2,17 @@ comment(# Regexp or division?)
ident(some_string)operator(.)ident(to_i) regexp<delimiter(/)char(\\s)content(+)delimiter(/)>
ident(some_string)operator(.)ident(split) operator(/) operator(+)regexp<delimiter(/)content( this is a regexp after a division )delimiter(/)>
ident(some_string)operator(.)ident(split) operator(/) operator(+) regexp<delimiter(/)content( this one, too )delimiter(/)>
-ident(some_string)operator(.)ident(split) regexp<delimiter(/)content(- )delimiter(/)> comment(# and this one is a regexp without division) \ No newline at end of file
+ident(some_string)operator(.)ident(split) regexp<delimiter(/)content(- )delimiter(/)> comment(# and this one is a regexp without division)
+
+ident(it) string<delimiter(")content(allows substitution to interact with other Regexp constructs)delimiter(")> reserved(do)
+ ident(str) operator(=) string<delimiter(")content(foo\)|(bar)delimiter(")>
+ regexp<delimiter(/)content(()inline<inline_delimiter(#{)ident(str)inline_delimiter(})>content(\))delimiter(/)>operator(.)ident(should) operator(==) regexp<delimiter(/)content((foo\)|(bar\))delimiter(/)>
+
+ ident(str) operator(=) string<delimiter(")content(a)delimiter(")>
+ regexp<delimiter(/)content([)inline<inline_delimiter(#{)ident(str)inline_delimiter(})>content(-z])delimiter(/)>operator(.)ident(should) operator(==) regexp<delimiter(/)content([a-z])delimiter(/)>
+
+ ident(not_compliant_on)operator(()symbol(:ruby)operator(\)) reserved(do)
+ ident(str) operator(=) string<delimiter(")content(J)delimiter(")>
+ ident(re) operator(=) regexp<delimiter(/)char(\\c#)content({str})delimiter(/)>operator(.)ident(should) operator(==) regexp<delimiter(/)char(\\cJ)delimiter(/)>
+ reserved(end)
+reserved(end) \ No newline at end of file
diff --git a/test/scanners/ruby/regexp.in.rb b/test/scanners/ruby/regexp.in.rb
index 956e6b8..e10e7a8 100644
--- a/test/scanners/ruby/regexp.in.rb
+++ b/test/scanners/ruby/regexp.in.rb
@@ -2,4 +2,17 @@
some_string.to_i /\s+/
some_string.split / +/ this is a regexp after a division /
some_string.split / + / this one, too /
-some_string.split /- / # and this one is a regexp without division \ No newline at end of file
+some_string.split /- / # and this one is a regexp without division
+
+it "allows substitution to interact with other Regexp constructs" do
+ str = "foo)|(bar"
+ /(#{str})/.should == /(foo)|(bar)/
+
+ str = "a"
+ /[#{str}-z]/.should == /[a-z]/
+
+ not_compliant_on(:ruby) do
+ str = "J"
+ re = /\c#{str}/.should == /\cJ/
+ end
+end \ No newline at end of file