Class: Test::Unit::TestCase
- Inherits:
-
Object
- Object
- Test::Unit::TestCase
- Defined in:
- lib/test/unit/systemtest.rb
Instance Method Summary collapse
- #assert_coredump(app, *args) {|out, err, status| ... } ⇒ Object
- #assert_failure(app, *args) {|out, err, status| ... } ⇒ Object
- #assert_no_coredump(app, *args) {|out, err, status| ... } ⇒ Object
- #assert_stopped(app, *args) {|out, err, status| ... } ⇒ Object
- #assert_success(app, *args) {|out, err, status| ... } ⇒ Object
- #run_app(app, *args) ⇒ Object
Instance Method Details
#assert_coredump(app, *args) {|out, err, status| ... } ⇒ Object
36 37 38 39 40 41 |
# File 'lib/test/unit/systemtest.rb', line 36 def assert_coredump(app, *args) out, err, status = run_app(app, args) assert_equal(true, status.coredump?, "Running #{[app,args].delete_if { |i| i.empty? }.join(" ")} did not coredump.") yield(out, err, status) if block_given? end |
#assert_failure(app, *args) {|out, err, status| ... } ⇒ Object
29 30 31 32 33 34 |
# File 'lib/test/unit/systemtest.rb', line 29 def assert_failure(app, *args) out, err, status = run_app(app, args) assert_equal(false, status.success?, "No failure running #{[app,args].delete_if { |i| i.empty? }.join(" ")}.") yield(out, err, status) if block_given? end |
#assert_no_coredump(app, *args) {|out, err, status| ... } ⇒ Object
42 43 44 45 46 47 |
# File 'lib/test/unit/systemtest.rb', line 42 def assert_no_coredump(app, *args) out, err, status = run_app(app, args) assert_equal(false, status.coredump?, "Running #{[app,args].delete_if { |i| i.empty? }.join(" ")} caused coredump.") yield(out, err, status) if block_given? end |
#assert_stopped(app, *args) {|out, err, status| ... } ⇒ Object
49 50 51 52 53 54 |
# File 'lib/test/unit/systemtest.rb', line 49 def assert_stopped(app, *args) out, err, status = run_app(app, args) assert_equal(true, status.stopped?, "Running #{[app,args].delete_if { |i| i.empty? }.join(" ")} not stopped.") yield(out, err, status) if block_given? end |
#assert_success(app, *args) {|out, err, status| ... } ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/test/unit/systemtest.rb', line 20 def assert_success(app, *args) args.compact! out, err, status = run_app(app, args) assert_equal(true, status.success?, "Failure running #{[app,args].delete_if { |i| i.empty? }.join(" ")} "+ "with error(s):\n => stderr: '#{err}'\n => stdout: '#{out}'.") yield(out, err, status) if block_given? end |
#run_app(app, *args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/test/unit/systemtest.rb', line 8 def run_app(app, *args) cmd = [app, args].flatten.join(" ") out = nil err = nil status = Open4.popen4(cmd) { |cid, stdin, stdout, stderr| out = stdout.read err = stderr.read stdin.close } [out, err, status] end |