~db-keen/rush/asterales-prep

« back to all changes in this revision

Viewing changes to test/unit/rubyunix/parsers/ghostwheel_helpers.rb

  • Committer: Daniel Brumbaugh Keeney
  • Date: 2008-03-10 02:53:16 UTC
  • Revision ID: devi.webmaster@gmail.com-20080310025316-3220q6hdsfybeyvk
added ruby-lex hack for the time being
added irb parser ( which uses the ruby-lex hack )
In Rakefile, moved sync_dirs out of the rake task into a top-level method
updated test folder to reflect vocab change syntax => parser
added name instance attribute to Rubyunix::Session
added parsers to rubyunix.rb, so they can be changed only in defaults.rb (soon to be replaced with asterales)
added send_directive for parser-independent commands
updated history.rb to new style guidelines
added syntax class attribute to parsers
updated session.rb
updated numerous ui files for style guidelines
fixed bug for Wxw.ttyout.puts( nonstring )

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
 
63
63
    return nil if @commands_faked_out
64
64
 
65
 
    class<<Rubyunix
 
65
    class << Rubyunix
66
66
      if respond_to? :send_command
67
67
        alias_method :old_send_command,:send_command
68
68
        remove_method :send_command
69
69
      end
70
70
      def send_command(*input)
71
 
        @sent_commands<<input
 
71
        @sent_commands << input
72
72
        return 1 if input[0]=='false'
73
73
        0
74
74
      end
83
83
  def setup_real_commands
84
84
    require 'rubyunix'
85
85
    return nil unless @commands_faked_out
86
 
    class<<Rubyunix
 
86
    class << Rubyunix
87
87
      remove_method :send_command
88
88
      alias_method :send_command,:old_send_command
89
89
    end
90
 
    @commands_faked_out=false
 
90
    @commands_faked_out = false
91
91
    true
92
92
  end
93
93
 
94
94
 
95
 
  def assert_execution script_str,commands=[],include_args=true
 
95
  def assert_execution script_str, commands = [], include_args = true
96
96
    setup_fake_commands
97
 
    assert_nothing_raised do @syntax.execute(script_str);end
 
97
    assert_nothing_raised do @syntax.execute script_str;end
98
98
    assert_equal(
99
99
      commands,
100
100
      Rubyunix.sent_commands)
103
103
 
104
104
 
105
105
 
106
 
  def assert_construct script_str,desired_construct,root=:script
 
106
  def assert_construct script_str, desired_construct, root = :script
107
107
    @parser.root = root
108
108
    assert(parse_result = @parser.parse(script_str))
109
 
    real_constructs=parse_result.constructs
 
109
    real_constructs = parse_result.constructs
110
110
    assert(real_constructs.has_key?(desired_construct))
111
111
    nil
112
112
  end
113
113
 
114
114
 
115
 
  def assert_constructs script_str,desired_constructs,root=:script
 
115
  def assert_constructs script_str, desired_constructs, root = :script
116
116
    @parser.root = root
117
117
    assert(parse_result = @parser.parse(script_str))
118
118
    assert_equal(
123
123
 
124
124
 
125
125
 
126
 
  def assert_commands script_str,desired_commands,root=:script
 
126
  def assert_commands script_str, desired_commands, root = :script
127
127
    @parser.root = root
128
128
    assert(parse_result = @parser.parse(script_str))
129
129
    assert_equal(
132
132
    nil
133
133
  end
134
134
 
135
 
  def assert_conditionals script_str,desired_numbers
 
135
  def assert_conditionals script_str, desired_numbers
136
136
    setup_fake_commands
137
137
    assert_nothing_raised do @syntax.execute(script_str);end
138
138
    assert_equal(