Class: Testrus::Runner
- Inherits:
-
Object
- Object
- Testrus::Runner
- Defined in:
- lib/testrus/runner.rb,
lib/testrus/runner/run.rb
Defined Under Namespace
Classes: Run
Constant Summary collapse
- LOG_FILE =
Internal: Specifies the log file.
"/tmp/testrus"
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
-
#initialize(command) ⇒ Runner
constructor
Responsible for running the actual test against a given command (program) a run object about the execution of the program against the given input.
-
#run(test) ⇒ Object
Public: Returns an object with the results of running the program against the input.
Constructor Details
#initialize(command) ⇒ Runner
Responsible for running the actual test against a given command (program) a run object about the execution of the program against the given input.
command - The String command to pass the input to
13 14 15 |
# File 'lib/testrus/runner.rb', line 13 def initialize(command) @command = command end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
3 4 5 |
# File 'lib/testrus/runner.rb', line 3 def command @command end |
Instance Method Details
#run(test) ⇒ Object
Public: Returns an object with the results of running the program against the input.
input - The String of input to pass to the program
Returns a Runner::Run object with information about the run.
23 24 25 26 |
# File 'lib/testrus/runner.rb', line 23 def run(test) system "echo '#{test.input}' | /usr/bin/time -l #{full_command} &> #{LOG_FILE}" Run.new File.read(LOG_FILE), test end |