nanotest 0.9 → 0.9.1
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.
- data/.gitignore +1 -0
- data/README.rdoc +51 -0
- data/Rakefile +23 -14
- data/examples.rb +2 -4
- data/lib/nanotest.rb +1 -1
- data/specs.watchr +3 -3
- data/test/test_helper.rb +5 -0
- data/test/test_nanotest.rb +2 -2
- metadata +4 -4
data/.gitignore
CHANGED
data/README.rdoc
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
=== Summary
|
2
|
+
|
3
|
+
Extremely mynymal test framework. Perfect for DIY lovers. NanoTest provides
|
4
|
+
the bare mynymum needed; for everything else, there's ruby.
|
5
|
+
|
6
|
+
=== Install
|
7
|
+
|
8
|
+
gem install nanotest --source http://gemcutter.org
|
9
|
+
|
10
|
+
=== Examples
|
11
|
+
|
12
|
+
require 'nanotest'
|
13
|
+
include NanoTest
|
14
|
+
|
15
|
+
assert { 1 == 1 }
|
16
|
+
assert { 1 >= 1 }
|
17
|
+
assert { 1 == 2 } #line 12
|
18
|
+
|
19
|
+
outputs:
|
20
|
+
|
21
|
+
..F
|
22
|
+
(examples.rb:012) assertion failed
|
23
|
+
|
24
|
+
=== API
|
25
|
+
|
26
|
+
NanoTest has a single method: #assert. You can either include NanoTest as
|
27
|
+
above, or use its method directly:
|
28
|
+
|
29
|
+
NanoTest.assert { true }
|
30
|
+
|
31
|
+
Its block is expected to return a boolean. If it's false (== false) it fails,
|
32
|
+
otherwise it passes. Simple as that.
|
33
|
+
|
34
|
+
#assert also accepts a custom failure message (defaults to "assertion failed"):
|
35
|
+
|
36
|
+
assert("foo is too small") { @foo > 5 } #line 36
|
37
|
+
#=> (examples.rb:036) foo is too small
|
38
|
+
|
39
|
+
That's pretty much it. Maximum Simplicity. If you insist on doing something
|
40
|
+
fancy, check out the wiki for a few tips and tricks.
|
41
|
+
|
42
|
+
=== Links
|
43
|
+
|
44
|
+
source:: http://github.com/mynyml/nanotest
|
45
|
+
docs:: http://rdoc.info/projects/mynyml/nanotest
|
46
|
+
wiki:: http://wiki.github.com/mynyml/nanotest
|
47
|
+
bugs:: http://github.com/mynyml/nanotest/issues
|
48
|
+
|
49
|
+
|
50
|
+
tl;dr: is small test fw. is fun. assert("msg") { bool }
|
51
|
+
|
data/Rakefile
CHANGED
@@ -1,23 +1,18 @@
|
|
1
|
-
begin
|
2
|
-
require 'yard'
|
3
|
-
rescue LoadError, RuntimeError
|
4
|
-
end
|
5
|
-
|
6
1
|
# --------------------------------------------------
|
7
2
|
# Gem
|
8
3
|
# --------------------------------------------------
|
9
4
|
def gemspec
|
10
5
|
@gemspec ||= Gem::Specification.new do |s|
|
11
6
|
s.name = "nanotest"
|
12
|
-
s.summary = "
|
13
|
-
s.description = "
|
7
|
+
s.summary = "When all you need is #assert"
|
8
|
+
s.description = "Extremely mynymal test framework. Perfect for DIY lovers. NanoTest provides the bare mynymum needed; for everything else, there's ruby."
|
14
9
|
s.author = "Martin Aumont"
|
15
10
|
s.email = "mynyml@gmail.com"
|
16
11
|
s.homepage = "http://github.com/mynyml/nanotest"
|
17
12
|
s.rubyforge_project = "nanotest"
|
18
13
|
s.has_rdoc = false
|
19
14
|
s.require_path = "lib"
|
20
|
-
s.version = "0.9"
|
15
|
+
s.version = "0.9.1"
|
21
16
|
s.files = File.read("Manifest").strip.split("\n")
|
22
17
|
|
23
18
|
s.add_development_dependency 'minitest'
|
@@ -44,18 +39,32 @@ namespace(:test) do
|
|
44
39
|
desc "Run all tests"
|
45
40
|
task(:all) do
|
46
41
|
tests = Dir['test/**/test_*.rb'] - ['test/test_helper.rb']
|
47
|
-
cmd = "ruby -rubygems -
|
42
|
+
cmd = "ruby -rubygems -I.:lib -e'%w( #{tests.join(' ')} ).each {|file| require file }'"
|
48
43
|
puts(cmd) if ENV['VERBOSE']
|
49
44
|
system(cmd)
|
50
45
|
end
|
46
|
+
|
47
|
+
desc "Run all tests on multiple ruby versions (requires rvm)"
|
48
|
+
task(:portability) do
|
49
|
+
versions = %w( 1.8.6 1.8.7 1.9 1.9.2 jruby jruby\ -v\ 1.4.0RC1 )
|
50
|
+
versions.each do |version|
|
51
|
+
system <<-BASH
|
52
|
+
bash -c 'source ~/.rvm/scripts/rvm;
|
53
|
+
rvm use #{version};
|
54
|
+
echo "--------- #{version} ----------";
|
55
|
+
rake -s test:all'
|
56
|
+
BASH
|
57
|
+
end
|
58
|
+
end
|
51
59
|
end
|
52
60
|
|
53
61
|
# --------------------------------------------------
|
54
62
|
# Docs
|
55
63
|
# --------------------------------------------------
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
64
|
+
desc "Generate YARD Documentation"
|
65
|
+
task :yardoc do
|
66
|
+
require 'yard'
|
67
|
+
files = %w( lib/**/*.rb )
|
68
|
+
options = %w( -o doc/yard --readme README.rdoc --files LICENSE )
|
69
|
+
YARD::CLI::Yardoc.run *(options + files)
|
61
70
|
end
|
data/examples.rb
CHANGED
data/lib/nanotest.rb
CHANGED
data/specs.watchr
CHANGED
@@ -18,9 +18,9 @@ end
|
|
18
18
|
# --------------------------------------------------
|
19
19
|
# Watchr Rules
|
20
20
|
# --------------------------------------------------
|
21
|
-
watch( '^examples\.rb' ) { |m|
|
22
|
-
watch( '^test.*/test_.*\.rb' ) { |m|
|
23
|
-
watch( '^lib/(.*)\.rb' ) { |m|
|
21
|
+
watch( '^examples\.rb' ) { |m| system( "ruby -rubygems -Ilib %s" % m[0] ) }
|
22
|
+
watch( '^test.*/test_.*\.rb' ) { |m| run( "ruby -rubygems -Ilib %s" % m[0] ) }
|
23
|
+
watch( '^lib/(.*)\.rb' ) { |m| run( "ruby -rubygems -Ilib test/test_%s.rb" % m[1] ) }
|
24
24
|
watch( '^test/test_helper\.rb' ) { run_all_tests }
|
25
25
|
|
26
26
|
# --------------------------------------------------
|
data/test/test_helper.rb
CHANGED
data/test/test_nanotest.rb
CHANGED
@@ -33,13 +33,13 @@ class TestNanoTest < MiniTest::Unit::TestCase
|
|
33
33
|
@line = __LINE__; NanoTest.assert { false }
|
34
34
|
end
|
35
35
|
assert_equal 1, NanoTest::FAILURES.size
|
36
|
-
assert_includes NanoTest::FAILURES, "(
|
36
|
+
assert_includes NanoTest::FAILURES, "(%s:%0.3d) assertion failed" % [__FILE__, @line]
|
37
37
|
end
|
38
38
|
|
39
39
|
test "custom failure message, file, line" do
|
40
40
|
capture_io do
|
41
41
|
NanoTest.assert('foo','bar',2) { false }
|
42
42
|
end
|
43
|
-
assert_includes NanoTest::FAILURES, "(bar:
|
43
|
+
assert_includes NanoTest::FAILURES, "(bar:002) foo"
|
44
44
|
end
|
45
45
|
end
|
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:
|
4
|
+
version: 0.9.1
|
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-
|
12
|
+
date: 2009-10-30 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
|
-
description:
|
25
|
+
description: Extremely mynymal test framework. Perfect for DIY lovers. NanoTest provides the bare mynymum needed; for everything else, there's ruby.
|
26
26
|
email: mynyml@gmail.com
|
27
27
|
executables: []
|
28
28
|
|
@@ -69,6 +69,6 @@ rubyforge_project: nanotest
|
|
69
69
|
rubygems_version: 1.3.5
|
70
70
|
signing_key:
|
71
71
|
specification_version: 3
|
72
|
-
summary:
|
72
|
+
summary: "When all you need is #assert"
|
73
73
|
test_files: []
|
74
74
|
|