File: examples.rb

package info (click to toggle)
ruby-nanotest 0.9.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 108 kB
  • ctags: 15
  • sloc: ruby: 123; makefile: 3
file content (31 lines) | stat: -rw-r--r-- 429 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'nanotest'
include  Nanotest

class Foo
  attr_accessor :bar
end

@foo = Foo.new

assert { @foo.is_a?(Foo) }
assert { @foo.respond_to?(:bar) }
assert { @foo.bar.nil? }

@foo.bar  = 'a'
@foo.bar << 'b'

assert {     @foo.bar == 'ab' }
assert { not @foo.bar == 'xy' }

@foo.bar = nil

assert { @foo.bar == 'ab' }
assert('boom') { false }

__END__
output:

.....FF
(examples.rb:021) assertion failed
(examples.rb:022) boom