nanotest 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  doc/
2
2
  pkg/
3
3
  .yardoc
4
+ *.gem
data/Manifest CHANGED
@@ -1,11 +1,12 @@
1
1
  .gitignore
2
2
  LICENSE
3
3
  Manifest
4
- README.rdoc
4
+ README.md
5
5
  Rakefile
6
6
  examples.rb
7
7
  gem.watchr
8
8
  lib/nanotest.rb
9
+ markdown.watchr
9
10
  nanotest.gemspec
10
11
  specs.watchr
11
12
  test/test_helper.rb
@@ -0,0 +1,64 @@
1
+ *"Frustra fit per plura quod potest fieri per pauciora."* --William of Ockham
2
+ "It is futile to do with more things that which can be done with fewer."
3
+
4
+ ### Summary
5
+
6
+ Extremely mynymal test framework. Perfect for DIY lovers. Nanotest provides
7
+ the bare mynymum needed; for everything else, there's ruby.
8
+
9
+ ### Install
10
+
11
+ gem install nanotest
12
+
13
+ ### Examples
14
+
15
+ require 'nanotest'
16
+ include Nanotest
17
+
18
+ assert { 1 == 1 }
19
+ assert { 2 > 1 }
20
+ assert { not 1 > 2 }
21
+ assert { 1 == 2 } #line 12
22
+
23
+ outputs:
24
+
25
+ ...F
26
+ (examples.rb:012) assertion failed
27
+
28
+ See actual use at <http://github.com/mynyml/phocus/blob/master/test/test_phocus.rb>
29
+
30
+ ### API
31
+
32
+ Nanotest has a single method: `#assert`. You can either include Nanotest as
33
+ above, or use its method directly: `Nanotest.assert { true }`. Its block is
34
+ expected to return a boolean. If it's false it fails, otherwise it passes.
35
+ Simple as that.
36
+
37
+ `#assert` also accepts a custom failure message:
38
+
39
+ assert("foo is too small") { @foo > 5 } #line 36
40
+ #=> (examples.rb:036) foo is too small
41
+
42
+ That's pretty much it. Maximum Simplicity. If you insist on doing something
43
+ fancy, check out the wiki for a few tips and tricks.
44
+
45
+ ### Stats
46
+
47
+ $ rake -s loc
48
+ lib contains 18 SLOCs
49
+
50
+ ### See Also
51
+
52
+ * [nanotest/extensions][1]
53
+ * [redgreen][2]
54
+
55
+ ### Links
56
+
57
+ * code: <http://github.com/mynyml/nanotest>
58
+ * docs: <http://rdoc.info/projects/mynyml/nanotest>
59
+ * wiki: <http://wiki.github.com/mynyml/nanotest>
60
+ * bugs: <http://github.com/mynyml/nanotest/issues>
61
+
62
+
63
+ [1]: http://github.com/mynyml/nanotest_extensions
64
+ [2]: http://github.com/mynyml/redgreen
data/Rakefile CHANGED
@@ -50,6 +50,6 @@ task(:loc) do
50
50
  loc += 1 unless line.strip.empty? || line.strip =~ /^#/
51
51
  end
52
52
  end
53
- puts "lib files contain #{loc} SLOCs"
53
+ puts "lib contains #{loc} SLOCs"
54
54
  end
55
55
 
@@ -1,29 +1,31 @@
1
1
  require 'nanotest'
2
- include NanoTest
2
+ include Nanotest
3
3
 
4
4
  class Foo
5
- attr_accessor :a
5
+ attr_accessor :bar
6
6
  end
7
7
 
8
8
  @foo = Foo.new
9
9
 
10
10
  assert { @foo.is_a?(Foo) }
11
- assert { @foo.respond_to?(:a) }
12
- assert { @foo.a.nil? }
11
+ assert { @foo.respond_to?(:bar) }
12
+ assert { @foo.bar.nil? }
13
13
 
14
- @foo.a = 'a'
15
- @foo.a << 'b'
14
+ @foo.bar = 'a'
15
+ @foo.bar << 'b'
16
16
 
17
- assert { @foo.a == 'ab' }
17
+ assert { @foo.bar == 'ab' }
18
+ assert { not @foo.bar == 'xy' }
18
19
 
19
- @foo.a = nil
20
+ @foo.bar = nil
20
21
 
21
- assert { @foo.a == 'a' }
22
+ assert { @foo.bar == 'ab' }
22
23
  assert('boom') { false }
23
24
 
24
25
  __END__
25
26
  output:
26
27
 
27
- ....FF
28
+ .....FF
28
29
  (examples.rb:021) assertion failed
29
30
  (examples.rb:022) boom
31
+
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env watchr
2
+
3
+ require 'pathname'
4
+ require 'rdiscount'
5
+ # --------------------------------------------------
6
+ # Helpers
7
+ # --------------------------------------------------
8
+ class ::String
9
+ def md2html
10
+ RDiscount.new(self).to_html
11
+ end
12
+ def save_as(path)
13
+ Pathname(path).open('w') {|f| f << self }
14
+ end
15
+ end
16
+
17
+ default_action do
18
+ md = Pathname('README.md').expand_path
19
+ html = Pathname('doc/README.html').expand_path
20
+
21
+ puts "Translating #{md.basename} (file://#{html})"
22
+ md.read.md2html.save_as(html)
23
+ end
24
+
25
+ # --------------------------------------------------
26
+ # Watchr Rules
27
+ # --------------------------------------------------
28
+ watch( '^README\.md' )
29
+
30
+ # --------------------------------------------------
31
+ # Signal Handling
32
+ # --------------------------------------------------
33
+ # Ctrl-\
34
+ Signal.trap('QUIT') { default_action.call }
35
+
36
+ # Ctrl-C
37
+ Signal.trap('INT') { abort("\n") }
38
+
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.rubyforge_project = "nanotest"
9
9
  s.has_rdoc = false
10
10
  s.require_path = "lib"
11
- s.version = "0.9.3"
11
+ s.version = "0.9.4"
12
12
  s.files = File.read("Manifest").strip.split("\n")
13
13
 
14
14
  s.add_development_dependency 'minitest'
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.3
4
+ version: 0.9.4
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-11-27 00:00:00 -03:00
12
+ date: 2009-12-07 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -34,11 +34,12 @@ files:
34
34
  - .gitignore
35
35
  - LICENSE
36
36
  - Manifest
37
- - README.rdoc
37
+ - README.md
38
38
  - Rakefile
39
39
  - examples.rb
40
40
  - gem.watchr
41
41
  - lib/nanotest.rb
42
+ - markdown.watchr
42
43
  - nanotest.gemspec
43
44
  - specs.watchr
44
45
  - test/test_helper.rb
@@ -1,59 +0,0 @@
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 { 2 > 1 }
17
- assert { not 1 > 2 }
18
- assert { 1 == 2 } #line 12
19
-
20
- outputs:
21
-
22
- ...F
23
- (examples.rb:012) assertion failed
24
-
25
- There's also a real life example at http://github.com/mynyml/phocus/blob/master/test/test_phocus.rb
26
-
27
- === API
28
-
29
- Nanotest has a single method: #assert. You can either include Nanotest as
30
- above, or use its method directly:
31
-
32
- Nanotest.assert { true }
33
-
34
- Its block is expected to return a boolean. If it's false it fails, otherwise
35
- it passes. Simple as that.
36
-
37
- #assert also accepts a custom failure message (defaults to "assertion failed"):
38
-
39
- assert("foo is too small") { @foo > 5 } #line 36
40
- #=> (examples.rb:036) foo is too small
41
-
42
- That's pretty much it. Maximum Simplicity. If you insist on doing something
43
- fancy, check out the wiki for a few tips and tricks.
44
-
45
- === Stats
46
-
47
- $ rake -s loc
48
- lib files contain 18 SLOCs
49
-
50
- === Links
51
-
52
- source:: http://github.com/mynyml/nanotest
53
- docs:: http://rdoc.info/projects/mynyml/nanotest
54
- wiki:: http://wiki.github.com/mynyml/nanotest
55
- bugs:: http://github.com/mynyml/nanotest/issues
56
-
57
-
58
- tl;dr: is small test fw. is fun. assert("msg") { bool }
59
-