# Author:: Nicolas Pouillard . # Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved. # License:: LGPL # $Id: Cmd.rb 567 2005-04-13 08:00:06Z polrop $ module TTK module Strategies # FIXME: explain here how to use it to test a command line based program class Cmd < CmdBase include Concrete # # Methods # def assertion fail('wrong exit value') if !@exit.nil? and @exit.to_i != @my_exit.to_i super end protected :assertion def failed_hook super @log.my_exit = @my_exit end protected :failed_hook def son_hook env_sub = proc do |k,v| ENV[k.to_s] = v.do_symtbl_gsub(@symtbl).gsub(/\$(\w+)/) { ENV[$1] } end @env.each(&env_sub) @symtbl[:env].each(&env_sub) if @symtbl[:env] end protected :son_hook # # Attributes # attribute :exit, 'the exit status reference' attribute :env, 'environment variables' do {} end end # class Cmd end # module Strategies end # module TTK