test/test_Syntax.rb in taskjuggler-3.1.0 vs test/test_Syntax.rb in taskjuggler-3.2.0

- old
+ new

@@ -14,12 +14,12 @@ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if __FILE__ == $0 $:.unshift File.dirname(__FILE__) require 'test/unit' -require 'MessageChecker' require 'taskjuggler/TaskJuggler' +require 'MessageChecker' class TestSyntax < Test::Unit::TestCase include MessageChecker @@ -28,21 +28,30 @@ ENV['TEST2'] = '"A test String"' ENV['TEST3'] = '3' path = File.dirname(__FILE__) + '/' Dir.glob(path + 'TestSuite/Syntax/Correct/*.tjp').each do |f| ENV['TZ'] = 'Europe/Berlin' - tj = TaskJuggler.new(false) + (mh = TaskJuggler::MessageHandlerInstance.instance).reset + mh.outputLevel = :none + mh.trapSetup = true + tj = TaskJuggler.new assert(tj.parse([ f ]), "Parser failed for #{f}") - assert(tj.messageHandler.messages.empty?, "Unexpected error in #{f}") + assert(mh.messages.empty?, "Unexpected error in #{f}") end end def test_syntaxErrors path = File.dirname(__FILE__) + '/' Dir.glob(path + 'TestSuite/Syntax/Errors/*.tjp').each do |f| ENV['TZ'] = 'Europe/Berlin' - tj = TaskJuggler.new(false) - assert(!tj.parse([ f ]), "Parser succedded for #{f}") + (mh = TaskJuggler::MessageHandlerInstance.instance).reset + mh.outputLevel = :none + mh.trapSetup = true + begin + tj = TaskJuggler.new + assert(!tj.parse([ f ]), "Parser succedded for #{f}") + rescue TaskJuggler::TjRuntimeError + end checkMessages(tj, f) end end end