nanotest 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,8 +28,8 @@ above, or use its method directly:
28
28
 
29
29
  NanoTest.assert { true }
30
30
 
31
- Its block is expected to return a boolean. If it's false (== false) it fails,
32
- otherwise it passes. Simple as that.
31
+ Its block is expected to return a boolean. If it's false it fails, otherwise
32
+ it passes. Simple as that.
33
33
 
34
34
  #assert also accepts a custom failure message (defaults to "assertion failed"):
35
35
 
@@ -39,6 +39,11 @@ otherwise it passes. Simple as that.
39
39
  That's pretty much it. Maximum Simplicity. If you insist on doing something
40
40
  fancy, check out the wiki for a few tips and tricks.
41
41
 
42
+ === Stats
43
+
44
+ $ rake -s loc
45
+ lib files contain 15 SLOCs
46
+
42
47
  === Links
43
48
 
44
49
  source:: http://github.com/mynyml/nanotest
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ def gemspec
12
12
  s.rubyforge_project = "nanotest"
13
13
  s.has_rdoc = false
14
14
  s.require_path = "lib"
15
- s.version = "0.9.1"
15
+ s.version = "0.9.2"
16
16
  s.files = File.read("Manifest").strip.split("\n")
17
17
 
18
18
  s.add_development_dependency 'minitest'
@@ -68,3 +68,18 @@ task :yardoc do
68
68
  options = %w( -o doc/yard --readme README.rdoc --files LICENSE )
69
69
  YARD::CLI::Yardoc.run *(options + files)
70
70
  end
71
+
72
+ # --------------------------------------------------
73
+ # Stats
74
+ # --------------------------------------------------
75
+ desc "LOC count"
76
+ task(:loc) do
77
+ loc = 0
78
+ Dir['lib/**/*'].each do |file|
79
+ File.read(file).each_line do |line|
80
+ loc += 1 unless line.strip.empty? || line.strip =~ /^#/
81
+ end
82
+ end
83
+ puts "lib files contain #{loc} SLOCs"
84
+ end
85
+
@@ -3,8 +3,8 @@ module NanoTest
3
3
 
4
4
  FAILURES = []
5
5
 
6
- def assert(msg="assertion failed",file=nil,line=nil,&block)
7
- if block.call == false
6
+ def assert(msg="assertion failed", file=nil, line=nil, &block)
7
+ unless block.call
8
8
  file ||= caller.first.split(':')[0]
9
9
  line ||= caller.first.split(':')[1]
10
10
  FAILURES << "(%s:%0.3d) %s" % [file,line,msg]
@@ -20,7 +20,7 @@ class TestNanoTest < MiniTest::Unit::TestCase
20
20
  assert_empty NanoTest::FAILURES
21
21
  end
22
22
 
23
- test "assertion fails" do
23
+ test "assertion fails (false)" do
24
24
  out, err = capture_io do
25
25
  NanoTest.assert { false }
26
26
  end
@@ -28,6 +28,14 @@ class TestNanoTest < MiniTest::Unit::TestCase
28
28
  refute_empty NanoTest::FAILURES
29
29
  end
30
30
 
31
+ test "assertion fails (nil)" do
32
+ out, err = capture_io do
33
+ NanoTest.assert { nil }
34
+ end
35
+ assert_equal 'F', out
36
+ refute_empty NanoTest::FAILURES
37
+ end
38
+
31
39
  test "failure message" do
32
40
  capture_io do
33
41
  @line = __LINE__; NanoTest.assert { false }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanotest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Aumont
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-30 00:00:00 -04:00
12
+ date: 2009-11-03 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency