[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdev-ruby] parser/tools: When expected test output doesn't exist,
From:       Alexander Dymo <adymo () kdevelop ! org>
Date:       2011-08-10 13:40:13
Message-ID: 20110810134013.9290AA60B4 () git ! kde ! org
[Download RAW message or body]

Git commit c216487addbf8659ee63aae22e787a2941cbccd0 by Alexander Dymo.
Committed on 10/08/2011 at 15:35.
Pushed by dymo into branch 'master'.

When expected test output doesn't exist, don't break the test suite, instead
print a warning message, fail the test and continue.

The right approach would be to show the diff and ask the user to accept or fail it.
This is for later.

M  +9    -1    parser/tools/suite.rb

http://commits.kde.org/kdev-ruby/c216487addbf8659ee63aae22e787a2941cbccd0

diff --git a/parser/tools/suite.rb b/parser/tools/suite.rb
index 412c758..071876b 100644
--- a/parser/tools/suite.rb
+++ b/parser/tools/suite.rb
@@ -29,6 +29,7 @@
 # can run it.
 
 require 'find'
+require 'fileutils'
 
 
 ##
@@ -53,8 +54,15 @@ def do_diff(str)
     exec("cd .. && ./ruby-parser tests/#{str} > tests/#{str}.out")
   end
   Process.waitpid(pid)
+
+  expected = str.gsub(/\.rb$/, '.txt')
+  unless File.exists?("../tests/#{expected}")
+      puts "Missing expected test output"
+      FileUtils::touch("../tests/#{expected}")
+  end
+
   pid = fork do
-    exec("cd ../tests && diff -swu #{str.gsub('.rb', '.txt')} #{str}.out > output.txt")
+    exec("cd ../tests && diff -swu #{expected} #{str}.out > output.txt")
   end
   Process.waitpid(pid)
   error = 0

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic