spec/regexp-examples_spec.rb in regexp-examples-0.5.2 vs spec/regexp-examples_spec.rb in regexp-examples-0.5.3
- old
+ new
@@ -101,27 +101,19 @@
/(?<name>namedgroup) \k<name>/
)
end
context "for escaped characters" do
- examples_exist_and_match(
- /\w/,
- /\W/,
- /\s/,
- /\S/,
- /\d/,
- /\D/,
- /\h/,
- /\H/,
- /\t/,
- /\n/,
- /\f/,
- /\a/,
- /\v/,
- /\e/,
- /[\b]/
- )
+ all_letters = Array('a'..'z') | Array('A'..'Z')
+ special_letters = %w(b c g p u x z A B C G M P Z)
+ valid_letters = all_letters - special_letters
+
+ valid_letters.each do |char|
+ backslash_char = "\\#{char}"
+ examples_exist_and_match( /#{backslash_char}/ )
+ end
+ examples_exist_and_match( /[\b]/ )
end
context "for backreferences" do
examples_exist_and_match(
/(repeat) \1/,
@@ -156,11 +148,10 @@
/(?!neglookahead)/,
/(?<=lookbehind)/,
/(?<!neglookbehind)/,
/\bword-boundary/,
/no\Bn-word-boundary/,
- /\Glast-match/,
/start-of\A-string/,
/start-of^-line/,
/end-of\Z-string/,
/end-of\z-string/,
/end-of$-line/
@@ -168,9 +159,10 @@
end
context "ignore start/end anchors if at start/end" do
examples_exist_and_match(
/\Astart/,
+ /\Glast-match/,
/^start/,
/end$/,
/end\z/,
/end\Z/
)