summaryrefslogtreecommitdiffstats
path: root/bootstraptest
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-17 17:02:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-17 17:02:30 +0000
commit2bf5b26e1cd859a2521001e26666fd2fda679794 (patch)
tree929bfa3e19a07919f80d5a8bbf7b00e268c1a54e /bootstraptest
parentfd7a3ad8277c5c306aea08ea9ecb8217208dcdff (diff)
downloadruby-2bf5b26e1cd859a2521001e26666fd2fda679794.tar.gz
ruby-2bf5b26e1cd859a2521001e26666fd2fda679794.tar.xz
ruby-2bf5b26e1cd859a2521001e26666fd2fda679794.zip
* bootstraptest/runner.rb (assert_valid_syntax): added.
* bootstraptest/test_knownbug.rb: added test for [ruby-list:44479] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/runner.rb15
-rw-r--r--bootstraptest/test_knownbug.rb1
2 files changed, 12 insertions, 4 deletions
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index e8651fea4..27b82947f 100644
--- a/bootstraptest/runner.rb
+++ b/bootstraptest/runner.rb
@@ -127,9 +127,9 @@ def exec_test(pathes)
end
end
-def assert_check(testsrc, message = '')
+def assert_check(testsrc, message = '', opt = '')
$stderr.puts "\##{@count} #{@location}" if @verbose
- result = get_result_string(testsrc)
+ result = get_result_string(testsrc, opt)
check_coredump
faildesc = yield(result)
if !faildesc
@@ -179,6 +179,13 @@ def assert_not_match(unexpected_pattern, testsrc, message = '')
}
end
+def assert_valid_syntax(testsrc, message = '')
+ newtest
+ assert_check(testsrc, message, '-c') {|result|
+ result if /Syntax OK/ !~ result
+ }
+end
+
def assert_normal_exit(testsrc, message = '')
newtest
$stderr.puts "\##{@count} #{@location}" if @verbose
@@ -268,11 +275,11 @@ def make_srcfile(src)
filename
end
-def get_result_string(src)
+def get_result_string(src, opt = '')
if @ruby
filename = make_srcfile(src)
begin
- `#{@ruby} -W0 #{filename}`
+ `#{@ruby} -W0 #{opt} #{filename}`
ensure
raise CoreDumpError, "core dumped" if $? and $?.coredump?
end
diff --git a/bootstraptest/test_knownbug.rb b/bootstraptest/test_knownbug.rb
index e8ad92796..acb62152d 100644
--- a/bootstraptest/test_knownbug.rb
+++ b/bootstraptest/test_knownbug.rb
@@ -75,3 +75,4 @@ assert_equal 'true', %{
$?.success?
}
+assert_valid_syntax('1.times {|i|print (42),1;}', '[ruby-list:44479]')