Changeset 34130
- Timestamp:
- 06/24/09 22:39:29 (4 years ago)
- Files:
-
- 1 modified
-
lang/ruby/chukan/trunk/chukan.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/chukan/trunk/chukan.rb
r32759 r34130 37 37 38 38 cli = spawn("client -arg1 -arg2") # run 'client' command with some arguments 39 sr c.stdout_join("connected") # wait until the server outputs "connected"39 srv.stdout_join("connected") # wait until the server outputs "connected" 40 40 41 41 cli.kill # send SIGKILL signal to the client 42 42 cli.join # wait until the client is really dead 43 srv.stderr_join(/disconnected/) # stderr and regexp are also usable43 srv.stderr_join(/disconnected/) # stderr and regexp are also available 44 44 45 45 srv.stdin.write "status\n" # input "status\n" to the server … … 47 47 48 48 if srv.stdout.read =~ /^client:/ # read output of the server 49 puts "** TEST FAILED **" # this library is usable for tests49 puts "** TEST FAILED **" # this library is usable for tests 50 50 # see also "Unit test" example below 51 51 end … … 69 69 # user name and path of the key is optional 70 70 71 cli_on_mac = mac.spawn("client -arg1") # run cilenton the remote host71 cli_on_mac = mac.spawn("client -arg1") # run 'client' on the remote host 72 72 cli_on_linux = linux.spawn("client -arg1") 73 73 … … 85 85 86 86 test "load mylibrary" do # Chukan::Test provides 'test' and 'run' methods 87 require "mylibrary" # test will fail if the block returns nil or false,87 require "mylibrary" # test will fail if the block returns nil or false, 88 88 # or an exception is raised 89 89 end 90 90 91 run {|b| # 'run' iterates yamldocuments written after91 run {|b| # 'run' iterates YAML documents written after 92 92 # __END__ line 93 test "score <= 100", :TODO do # second argument of 'test' is :TODO or :SKIP94 b.score <= 100 # which is useful for Test Anything Protocol95 end # (TAP) processor like prove 93 test "score <= 100", :TODO do # second argument of 'test' is :TODO or :SKIP 94 b.score <= 100 # which is useful for Test Anything Protocol 95 end # (TAP) processor like 'prove' 96 96 } 97 97 98 98 __END__ 99 --- # yamldocuments are here99 --- # YAML documents are here 100 100 name: test A 101 101 user: a-san
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)