Permalink
Browse files

define some more tests over each item of test data

to check for problems with several new constructions (notably form escs)
wrapping each specimen of ruby code
these tests are kinda weak... just check for no error, not
absolutely correct output
  • Loading branch information...
1 parent 126e1e6 commit d4cf3c7f2d3aa40a29e232da8ff4f783c6bf4384 @calebc calebc committed Jun 7, 2011
Showing with 23 additions and 0 deletions.
  1. +23 −0 test/test_form.rb
View
@@ -66,6 +66,29 @@ def setup
define_method "test_form_around_#{escaped}" do
check x
end if SLOW or rand<0.5
+ define_method "test_form_and_escape_around_#{escaped}" do
+ if /\A *undef /===x
+ err=RedParse::ParseError
+ end
+ begin
+ check_for_syntax_error x
+ rescue err||NilClass #ignore
+ else fail "#{err} expected, but none occurred" if err
+ end
+ end if SLOW or rand<0.5 unless /\A\s*(?:=begin|return|next|break)/===x
+ define_method "test_form_and_call_and_escape_around_#{escaped}" do
+ if /\A *undef /===x
+ err=RedParse::ParseError
+ end
+ begin
+ check_for_syntax_error x, ":(foo(^","\n))"
+ rescue err||NilClass #ignore
+ else fail "#{err} expected, but none occurred" if err
+ end
+ end if SLOW or rand<0.5 unless /\A\s*(?:=begin|return|next|break)/===x
+ define_method "test_Macro.expand_of_#{escaped}" do
+ check_for_syntax_error x,"",""
+ end if SLOW or rand<0.5
}
def check(code,pre="\n",post="\n")

0 comments on commit d4cf3c7

Please sign in to comment.