/rakelib/contrib/ottobehrens/tests/topaz_test_case.rb
Ruby | 41 lines | 32 code | 8 blank | 1 comment | 0 complexity | 04a158907cfca9e87a6d668641a24fea MD5 | raw file
Possible License(s): LGPL-2.1
1#!/usr/bin/ruby 2 3require File.join(File.dirname(__FILE__), "..", 'stone') 4require File.join(File.dirname(__FILE__), "..", 'topaz') 5 6require File.join(File.dirname(__FILE__), 'common_test_case') 7 8class TopazTestCase < BaseTestCase 9 def setup 10 super 11 @stone = Stone.create(TEST_STONE_NAME) 12 @stone.start 13 @topaz = Topaz.new(@stone) 14 end 15 16 def test_simple_commands 17 @topaz.commands(["status", "exit"]) 18 fail "Output is #{@topaz.output[1]}" if /^Current settings are\:/ !~ @topaz.output.last 19 20 @topaz.commands(["status", "exit"]) 21 fail "Output is #{@topaz.output[1]}" if /^Current settings are\:/ !~ @topaz.output.last 22 end 23 24 def test_login 25 @topaz.commands(["set gems #{@stone.name} u DataCurator p swordfish", "login", "exit"]) 26 fail "Output is #{@topaz.output[2]}" if /^successful login/ !~ @topaz.output.last 27 end 28 29 def test_nested_commands 30 @topaz.commands(["set gems #{@stone.name} u DataCurator p swordfish", 31 "login", 32 "level 0", 33 ["printit", "| x |", "x := 6 + 4", "%"], 34 "exit"]) 35 fail "Output is #{@topaz.output.last}" if /^10/ !~ @topaz.output.last 36 end 37 38 def test_fail 39 assert_raises(TopazError) { @topaz.commands(["an invalid command"]) } 40 end 41end