micro_test 0.4.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/mt +8 -9
- data/ext/mkrf_conf.rb +1 -1
- data/lib/micro_test.rb +1 -1
- data/lib/micro_test/formatters/base_formatter.rb +14 -3
- data/lib/micro_test/{color.rb → formatters/color.rb} +4 -0
- data/lib/micro_test/formatters/default_async_formatter.rb +11 -58
- data/lib/micro_test/formatters/default_formatter.rb +5 -70
- data/lib/micro_test/formatters/template.rb +50 -0
- data/lib/micro_test/formatters/views/default/assert_fail.txt.erb +6 -0
- data/lib/micro_test/formatters/views/default/class.txt.erb +2 -0
- data/lib/micro_test/formatters/views/default/suite.txt.erb +6 -0
- data/lib/micro_test/formatters/views/default/test_fail.txt.erb +2 -0
- data/lib/micro_test/formatters/views/default/test_pass.txt.erb +1 -0
- data/lib/micro_test/formatters/views/default_async/test.txt.erb +1 -0
- data/lib/micro_test/test_wrapper.rb +7 -1
- data/lib/micro_test/version.rb +1 -1
- data/test/color_test.rb +2 -0
- data/test/cpu_latency_test.rb +2 -0
- data/test/fail_test.rb +2 -0
- data/test/io_latency_test.rb +2 -0
- data/test/runner_test.rb +2 -0
- data/test/test_helper.rb +4 -0
- data/test/test_test.rb +2 -0
- data/test/test_wrapper_test.rb +2 -0
- metadata +49 -35
- data/lib/micro_test/formatters/doc_formatter.rb +0 -56
- data/lib/micro_test/formatters/dots_formatter.rb +0 -19
- data/lib/micro_test/formatters/min_formatter.rb +0 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 10c5f99129f2b7a608222a2fe1e1aff39a9be564
|
4
|
+
data.tar.gz: fbbfb9a6931bf5eaebaafd894f0f7ccb3303528f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 17dcddaf64ce23e5ec74ae12320406aaf5716e59390f808af19a48f666d80b5069c9eacc4e639fcd6bc6b807f7eca63b986527de17a3643f40ff060271f7469e
|
7
|
+
data.tar.gz: 0dc7e94f136bca35ed219c918b9492645329fec092b4d47dbe0b277f5c535e84ca765d23eb21b125dc8268de4c10ab45057f86f88a2963fd2dd78be199a7ea9f
|
data/bin/mt
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require "optparse"
|
3
|
+
require_relative "../lib/micro_test"
|
3
4
|
|
4
|
-
lib_path = File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
|
5
|
-
require File.join(lib_path, "micro_test")
|
6
5
|
include MicroTest::Color
|
7
6
|
|
8
7
|
# setup the formatters list ---------------------------------------------------
|
@@ -68,7 +67,7 @@ ENV["MT_DEMO"] = "true" if options[:demo]
|
|
68
67
|
|
69
68
|
# setup the test path ---------------------------------------------------------
|
70
69
|
path = ARGV.last unless ARGV.last =~ /^-/
|
71
|
-
path = File.expand_path(
|
70
|
+
path = File.expand_path("../../test", __FILE__) if options[:demo]
|
72
71
|
path ||= "test"
|
73
72
|
path = File.join(Dir.pwd, path) unless path =~ /^\//
|
74
73
|
unless File.exist?(path)
|
@@ -79,7 +78,7 @@ end
|
|
79
78
|
if path =~ /\.rb$/
|
80
79
|
require path
|
81
80
|
else
|
82
|
-
Dir[File.join(path, "
|
81
|
+
Dir[File.join(path, "**/*.rb")].each { |path| require path }
|
83
82
|
end
|
84
83
|
|
85
84
|
# setup the formatter ---------------------------------------------------------
|
@@ -113,13 +112,13 @@ if options[:pry]
|
|
113
112
|
|
114
113
|
Pry.config.hooks.add_hook :before_session, :print_instructions do |_, _, _pry_|
|
115
114
|
puts
|
116
|
-
puts " Pry session started"
|
117
|
-
puts
|
118
|
-
puts " #{
|
119
|
-
puts " #{
|
115
|
+
puts magenta(" Pry session started")
|
116
|
+
puts magenta("".ljust(80, "-"))
|
117
|
+
puts " #{magenta " Failures:"} Type #{green "up"} to see the line that failed"
|
118
|
+
puts " #{magenta "Exceptions:"} Type #{green "whereami"} to get your bearings"
|
120
119
|
puts
|
121
120
|
puts " Type #{green "exit"} or #{green "<CTL-D>"} to continue"
|
122
|
-
puts
|
121
|
+
puts magenta("".ljust(80, "-"))
|
123
122
|
puts
|
124
123
|
end
|
125
124
|
|
data/ext/mkrf_conf.rb
CHANGED
@@ -26,7 +26,7 @@ rescue Exception => e
|
|
26
26
|
exit(1)
|
27
27
|
end
|
28
28
|
|
29
|
-
f = File.open(File.
|
29
|
+
f = File.open(File.expand_path("../Rakefile", __FILE__), "w") # create dummy rakefile to indicate success
|
30
30
|
f.write("task :default\n")
|
31
31
|
f.close
|
32
32
|
|
data/lib/micro_test.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
path = File.expand_path("../micro_test/*.rb", __FILE__)
|
2
2
|
Dir[path].each { |file| require file }
|
3
3
|
|
4
|
-
path = File.expand_path("../micro_test/formatters
|
4
|
+
path = File.expand_path("../micro_test/formatters/**/*.rb", __FILE__)
|
5
5
|
Dir[path].each { |file| require file }
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "..", "color")
|
2
|
-
|
3
1
|
module MicroTest
|
4
2
|
|
5
3
|
class << self
|
@@ -12,7 +10,6 @@ module MicroTest
|
|
12
10
|
# Defines the API that formatters can/should implement
|
13
11
|
# to control test run output.
|
14
12
|
class BaseFormatter
|
15
|
-
include MicroTest::Color
|
16
13
|
attr_accessor :passed, :failed, :duration
|
17
14
|
|
18
15
|
class << self
|
@@ -59,5 +56,19 @@ module MicroTest
|
|
59
56
|
def after_suite(test_classes)
|
60
57
|
end
|
61
58
|
|
59
|
+
def render(template_name, template_context=nil)
|
60
|
+
puts text_to_render(template_name, template_context)
|
61
|
+
end
|
62
|
+
|
63
|
+
def render_inline(template_name, template_context=nil)
|
64
|
+
print text_to_render(template_name, template_context)
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def text_to_render(template_name, template_context=nil)
|
70
|
+
Template.new(template_context || self).render_to_string(template_name)
|
71
|
+
end
|
72
|
+
|
62
73
|
end
|
63
74
|
end
|
@@ -1,85 +1,38 @@
|
|
1
|
-
|
1
|
+
require_relative "base_formatter"
|
2
2
|
|
3
3
|
module MicroTest
|
4
4
|
class DefaultAsyncFormatter < MicroTest::BaseFormatter
|
5
5
|
set_short_name "default_async"
|
6
6
|
|
7
7
|
def after_test(test)
|
8
|
-
|
8
|
+
render_inline "default_async/test", test
|
9
9
|
end
|
10
10
|
|
11
11
|
def after_suite(test_classes)
|
12
12
|
puts
|
13
13
|
test_classes.each do |test_class|
|
14
|
-
|
14
|
+
render_output_for_test_class test_class
|
15
15
|
end
|
16
|
-
|
17
|
-
|
18
|
-
print " #{passed + failed} Tests finished in #{yellow duration} seconds. "
|
19
|
-
totals = []
|
20
|
-
totals << green("#{passed} Passed") if passed > 0
|
21
|
-
totals << red("#{failed} Failed") if failed > 0
|
22
|
-
print "(#{totals.join(", ")})"
|
23
|
-
puts
|
24
|
-
puts
|
16
|
+
|
17
|
+
render "default/suite"
|
25
18
|
end
|
26
19
|
|
27
20
|
private
|
28
21
|
|
29
|
-
def
|
30
|
-
|
31
|
-
puts test_class.name.ljust(80, "-")
|
22
|
+
def render_output_for_test_class(test_class)
|
23
|
+
render "default/class", test_class
|
32
24
|
test_class.tests.each do |test|
|
33
|
-
|
25
|
+
render_output_for_test test
|
34
26
|
end
|
35
27
|
end
|
36
28
|
|
37
|
-
def
|
29
|
+
def render_output_for_test(test)
|
38
30
|
return unless test.finished?
|
39
|
-
duration = (test.duration * 10**4).round.to_f / 10**4
|
40
|
-
print yellow(" #{duration.to_s.ljust(6, "0")}")
|
41
31
|
|
42
32
|
if test.passed?
|
43
|
-
|
33
|
+
render "default/test_pass", test
|
44
34
|
else
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
puts
|
49
|
-
end
|
50
|
-
|
51
|
-
def print_test_failure(test)
|
52
|
-
puts red(" #{test.desc}")
|
53
|
-
test.failed_asserts.each do |assert|
|
54
|
-
print_assert_failure assert
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def print_assert_failure(assert)
|
59
|
-
puts
|
60
|
-
print "".ljust(9)
|
61
|
-
puts "#{assert[:file_path]}:#{red(assert[:line_num])}"
|
62
|
-
puts "".ljust(9) + "".rjust(71, "-")
|
63
|
-
index = assert[:line_num] - 1
|
64
|
-
start = index - 2
|
65
|
-
start = 0 if start <= 0
|
66
|
-
finish = index + 2
|
67
|
-
finish = assert[:lines].length - 1 if finish >= assert[:lines].length
|
68
|
-
print_assert_failure_lines assert, start, finish, index
|
69
|
-
end
|
70
|
-
|
71
|
-
def print_assert_failure_lines(assert, start, finish, index)
|
72
|
-
(start..finish).each do |i|
|
73
|
-
print "".ljust(9)
|
74
|
-
if i == index
|
75
|
-
print red((i + 1).to_s.rjust(3, "0"))
|
76
|
-
print red("|")
|
77
|
-
print red(assert[:lines][i])
|
78
|
-
else
|
79
|
-
print (i + 1).to_s.rjust(3, "0")
|
80
|
-
print "|"
|
81
|
-
print assert[:lines][i]
|
82
|
-
end
|
35
|
+
render "default/test_fail", test
|
83
36
|
end
|
84
37
|
end
|
85
38
|
|
@@ -1,88 +1,23 @@
|
|
1
|
-
|
1
|
+
require_relative "base_formatter"
|
2
2
|
|
3
3
|
module MicroTest
|
4
4
|
class DefaultFormatter < MicroTest::BaseFormatter
|
5
5
|
set_short_name "default"
|
6
6
|
|
7
7
|
def before_class(test_class)
|
8
|
-
|
9
|
-
print_with_line test_class.name
|
8
|
+
render "default/class", test_class
|
10
9
|
end
|
11
10
|
|
12
11
|
def after_test(test)
|
13
|
-
duration = (test.duration * 10**4).round.to_f / 10**4
|
14
|
-
color = duration < 0.01 ? :yellow : :red
|
15
|
-
print send(color, " #{duration.to_s.ljust(6, "0")}")
|
16
|
-
|
17
12
|
if test.passed?
|
18
|
-
|
13
|
+
render "default/test_pass", test
|
19
14
|
else
|
20
|
-
|
15
|
+
render "default/test_fail", test
|
21
16
|
end
|
22
|
-
|
23
|
-
puts
|
24
17
|
end
|
25
18
|
|
26
19
|
def after_suite(test_classes)
|
27
|
-
|
28
|
-
print_line
|
29
|
-
print_totals
|
30
|
-
puts " in #{yellow duration} seconds."
|
31
|
-
print_line
|
32
|
-
puts
|
33
|
-
puts
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def print_with_line(value)
|
39
|
-
puts "#{value} ".ljust(80, "-")
|
40
|
-
end
|
41
|
-
|
42
|
-
def print_line
|
43
|
-
puts "".ljust(80, "-")
|
44
|
-
end
|
45
|
-
|
46
|
-
def print_totals
|
47
|
-
totals = []
|
48
|
-
totals << green("#{passed} Passed") if passed > 0
|
49
|
-
totals << red("#{failed} Failed") if failed > 0
|
50
|
-
print totals.join(", ")
|
51
|
-
end
|
52
|
-
|
53
|
-
def print_test_failure(test)
|
54
|
-
puts red(" #{test.desc}")
|
55
|
-
test.failed_asserts.each do |assert|
|
56
|
-
print_assert_failure assert
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def print_assert_failure(assert)
|
61
|
-
puts
|
62
|
-
print "".ljust(9)
|
63
|
-
puts "#{assert[:file_path]}:#{red(assert[:line_num])}"
|
64
|
-
puts "".ljust(9) + "".rjust(71, "-")
|
65
|
-
index = assert[:line_num] - 1
|
66
|
-
start = index - 2
|
67
|
-
start = 0 if start <= 0
|
68
|
-
finish = index + 2
|
69
|
-
finish = assert[:lines].length - 1 if finish >= assert[:lines].length
|
70
|
-
print_assert_failure_lines assert, start, finish, index
|
71
|
-
end
|
72
|
-
|
73
|
-
def print_assert_failure_lines(assert, start, finish, index)
|
74
|
-
(start..finish).each do |i|
|
75
|
-
print "".ljust(9)
|
76
|
-
if i == index
|
77
|
-
print red((i + 1).to_s.rjust(3, "0"))
|
78
|
-
print red("|")
|
79
|
-
print red(assert[:lines][i])
|
80
|
-
else
|
81
|
-
print (i + 1).to_s.rjust(3, "0")
|
82
|
-
print "|"
|
83
|
-
print assert[:lines][i]
|
84
|
-
end
|
85
|
-
end
|
20
|
+
render "default/suite"
|
86
21
|
end
|
87
22
|
|
88
23
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require_relative "color"
|
2
|
+
|
3
|
+
module MicroTest
|
4
|
+
class Template
|
5
|
+
include Color
|
6
|
+
|
7
|
+
def self.view(name)
|
8
|
+
@views ||= {}
|
9
|
+
@views[name] ||= File.read(File.expand_path("../views/#{name}.txt.erb", __FILE__))
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(context)
|
13
|
+
@context = context
|
14
|
+
end
|
15
|
+
|
16
|
+
def render_to_string(name)
|
17
|
+
instance_eval do
|
18
|
+
ERB.new(self.class.view(name), nil, "%<>-").result(binding)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def partial(name, *collection)
|
23
|
+
return render_to_string(name) if collection.empty?
|
24
|
+
collection.map do |item|
|
25
|
+
Template.new(item).render_to_string(name)
|
26
|
+
end.join("\n")
|
27
|
+
end
|
28
|
+
|
29
|
+
def duration_color(duration)
|
30
|
+
return :yellow if @context.duration <= 0.01
|
31
|
+
:red
|
32
|
+
end
|
33
|
+
|
34
|
+
def assert_lines(assert)
|
35
|
+
index = assert[:line_num] - 1
|
36
|
+
start = index - 2
|
37
|
+
start = 0 if start <= 0
|
38
|
+
finish = index + 2
|
39
|
+
finish = assert[:lines].length - 1 if finish >= assert[:lines].length
|
40
|
+
(start..finish).map do |i|
|
41
|
+
{
|
42
|
+
:line_num => (i + 1),
|
43
|
+
:line => assert[:lines][i],
|
44
|
+
:color => (i == index ? :red : :gray)
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= @context[:file_path].strip %><%= gray ":" %><%= red @context[:line_num] %>
|
2
|
+
<%= red "".ljust(80, "-") %>
|
3
|
+
<% assert_lines(@context).each do |line| -%>
|
4
|
+
<%= send line[:color], line[:line_num].to_s.rjust(4) %><%= gray "|" %> <%= send line[:color], line[:line] -%>
|
5
|
+
<% end -%>
|
6
|
+
<%= red "".ljust(80, "-") %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
|
2
|
+
--------------------------------------------------------------------------------
|
3
|
+
<%= green "#{@context.passed} Passed" -%>, <%= red "#{@context.failed} Failed" -%>
|
4
|
+
Finished in <%= yellow @context.duration %> seconds.
|
5
|
+
--------------------------------------------------------------------------------
|
6
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= send duration_color(@context.duration), @context.duration %> <%= green @context.desc -%>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= gray "." -%>
|
@@ -6,7 +6,7 @@ module MicroTest
|
|
6
6
|
# Exists for the purpose of isolating the test method so it can run in its own thread.
|
7
7
|
class TestWrapper
|
8
8
|
include MonitorMixin
|
9
|
-
attr_reader :test_class, :desc, :asserts
|
9
|
+
attr_reader :test_class, :desc, :asserts
|
10
10
|
|
11
11
|
# Constructor.
|
12
12
|
# @param [MicroTest::Test] test_class The test class that defines the test being wrapped.
|
@@ -98,6 +98,12 @@ module MicroTest
|
|
98
98
|
@duration = nil
|
99
99
|
end
|
100
100
|
|
101
|
+
# Rounded duration.
|
102
|
+
def duration
|
103
|
+
return nil if @duration.nil?
|
104
|
+
(@duration * 10**4).ceil.to_f / 10**4
|
105
|
+
end
|
106
|
+
|
101
107
|
private
|
102
108
|
|
103
109
|
# Builds a Hash of assert information for the given call stack.
|
data/lib/micro_test/version.rb
CHANGED
data/test/color_test.rb
CHANGED
data/test/cpu_latency_test.rb
CHANGED
data/test/fail_test.rb
CHANGED
data/test/io_latency_test.rb
CHANGED
data/test/runner_test.rb
CHANGED
data/test/test_helper.rb
ADDED
data/test/test_test.rb
CHANGED
data/test/test_wrapper_test.rb
CHANGED
metadata
CHANGED
@@ -1,49 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: micro_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.4.4
|
4
|
+
version: 0.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nathan Hopkins
|
9
|
-
autorequire:
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-11-16 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: os
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
16
22
|
version_requirements: !ruby/object:Gem::Requirement
|
17
23
|
requirements:
|
18
|
-
- -
|
24
|
+
- - ">="
|
19
25
|
- !ruby/object:Gem::Version
|
20
26
|
version: '0'
|
21
|
-
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
22
29
|
requirement: !ruby/object:Gem::Requirement
|
23
30
|
requirements:
|
24
|
-
- -
|
31
|
+
- - ">="
|
25
32
|
- !ruby/object:Gem::Version
|
26
33
|
version: '0'
|
27
|
-
|
34
|
+
type: :development
|
28
35
|
prerelease: false
|
29
|
-
type: :runtime
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: rake
|
32
36
|
version_requirements: !ruby/object:Gem::Requirement
|
33
37
|
requirements:
|
34
|
-
- -
|
38
|
+
- - ">="
|
35
39
|
- !ruby/object:Gem::Version
|
36
40
|
version: '0'
|
37
|
-
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
38
43
|
requirement: !ruby/object:Gem::Requirement
|
39
44
|
requirements:
|
40
|
-
- -
|
45
|
+
- - ">="
|
41
46
|
- !ruby/object:Gem::Version
|
42
47
|
version: '0'
|
43
|
-
none: false
|
44
|
-
prerelease: false
|
45
48
|
type: :development
|
46
|
-
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: 'Speed up your test workflow: fail -> pry -> pass'
|
47
56
|
email:
|
48
57
|
- natehop@gmail.com
|
49
58
|
executables:
|
@@ -52,57 +61,62 @@ extensions:
|
|
52
61
|
- ext/mkrf_conf.rb
|
53
62
|
extra_rdoc_files: []
|
54
63
|
files:
|
64
|
+
- bin/mt
|
55
65
|
- ext/mkrf_conf.rb
|
56
66
|
- lib/micro_test.rb
|
57
|
-
- lib/micro_test/
|
67
|
+
- lib/micro_test/formatters/base_formatter.rb
|
68
|
+
- lib/micro_test/formatters/color.rb
|
69
|
+
- lib/micro_test/formatters/default_async_formatter.rb
|
70
|
+
- lib/micro_test/formatters/default_formatter.rb
|
71
|
+
- lib/micro_test/formatters/template.rb
|
72
|
+
- lib/micro_test/formatters/views/default/assert_fail.txt.erb
|
73
|
+
- lib/micro_test/formatters/views/default/class.txt.erb
|
74
|
+
- lib/micro_test/formatters/views/default/suite.txt.erb
|
75
|
+
- lib/micro_test/formatters/views/default/test_fail.txt.erb
|
76
|
+
- lib/micro_test/formatters/views/default/test_pass.txt.erb
|
77
|
+
- lib/micro_test/formatters/views/default_async/test.txt.erb
|
58
78
|
- lib/micro_test/runner.rb
|
59
79
|
- lib/micro_test/test.rb
|
60
80
|
- lib/micro_test/test_wrapper.rb
|
61
81
|
- lib/micro_test/version.rb
|
62
|
-
- lib/micro_test/formatters/base_formatter.rb
|
63
|
-
- lib/micro_test/formatters/default_async_formatter.rb
|
64
|
-
- lib/micro_test/formatters/default_formatter.rb
|
65
|
-
- lib/micro_test/formatters/doc_formatter.rb
|
66
|
-
- lib/micro_test/formatters/dots_formatter.rb
|
67
|
-
- lib/micro_test/formatters/min_formatter.rb
|
68
|
-
- bin/mt
|
69
82
|
- test/color_test.rb
|
70
83
|
- test/cpu_latency_test.rb
|
71
84
|
- test/fail_test.rb
|
72
85
|
- test/io_latency_test.rb
|
73
86
|
- test/runner_test.rb
|
87
|
+
- test/test_helper.rb
|
74
88
|
- test/test_test.rb
|
75
89
|
- test/test_wrapper_test.rb
|
76
90
|
homepage: https://github.com/hopsoft/micro_test
|
77
91
|
licenses:
|
78
92
|
- MIT
|
79
|
-
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
80
95
|
rdoc_options: []
|
81
96
|
require_paths:
|
82
97
|
- lib
|
83
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
99
|
requirements:
|
85
|
-
- -
|
100
|
+
- - ">="
|
86
101
|
- !ruby/object:Gem::Version
|
87
102
|
version: 1.9.2
|
88
|
-
none: false
|
89
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
104
|
requirements:
|
91
|
-
- -
|
105
|
+
- - ">="
|
92
106
|
- !ruby/object:Gem::Version
|
93
107
|
version: '0'
|
94
|
-
none: false
|
95
108
|
requirements: []
|
96
|
-
rubyforge_project:
|
97
|
-
rubygems_version:
|
98
|
-
signing_key:
|
99
|
-
specification_version:
|
100
|
-
summary:
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.2.2
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: 'Speed up your test workflow: fail -> pry -> pass'
|
101
114
|
test_files:
|
102
115
|
- test/color_test.rb
|
103
116
|
- test/cpu_latency_test.rb
|
104
117
|
- test/fail_test.rb
|
105
118
|
- test/io_latency_test.rb
|
106
119
|
- test/runner_test.rb
|
120
|
+
- test/test_helper.rb
|
107
121
|
- test/test_test.rb
|
108
122
|
- test/test_wrapper_test.rb
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "base_formatter")
|
2
|
-
|
3
|
-
module MicroTest
|
4
|
-
class DocFormatter < MicroTest::BaseFormatter
|
5
|
-
set_short_name "doc"
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@failures = []
|
9
|
-
end
|
10
|
-
|
11
|
-
def before_class(test_class)
|
12
|
-
puts "\n#{test_class.name}"
|
13
|
-
end
|
14
|
-
|
15
|
-
def after_test(test)
|
16
|
-
super
|
17
|
-
if test.passed?
|
18
|
-
puts green(" #{test.desc}")
|
19
|
-
else
|
20
|
-
test.asserts.each do |assert|
|
21
|
-
next if assert[:value]
|
22
|
-
@failures << { :test => test, :assert => assert }
|
23
|
-
puts red(" #{test.desc}")
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def print_failures(failures)
|
29
|
-
puts
|
30
|
-
puts "Failures:"
|
31
|
-
puts
|
32
|
-
failures.each_with_index do |failure, idx|
|
33
|
-
test = failure[:test]
|
34
|
-
assert = failure[:assert]
|
35
|
-
puts
|
36
|
-
puts " #{idx + 1}) #{test.test_class.name} #{test.desc}"
|
37
|
-
puts red(" Failure/Error: #{assert[:line].strip}")
|
38
|
-
puts cyan(" #{assert[:file_path]}:#{assert[:line_num]}")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def after_suite(test_classes)
|
43
|
-
print_failures(@failures) if failed > 0
|
44
|
-
puts
|
45
|
-
msg = "#{passed + failed} examples, #{failed} failures"
|
46
|
-
if failed > 0
|
47
|
-
puts red(msg)
|
48
|
-
else
|
49
|
-
puts msg
|
50
|
-
end
|
51
|
-
puts
|
52
|
-
super
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "base_formatter")
|
2
|
-
|
3
|
-
module MicroTest
|
4
|
-
class DotsFormatter < MicroTest::BaseFormatter
|
5
|
-
set_short_name "dots"
|
6
|
-
|
7
|
-
def after_test(test)
|
8
|
-
print(test.passed? ? green(".") : red("."))
|
9
|
-
end
|
10
|
-
|
11
|
-
def after_suite(test_classes)
|
12
|
-
puts
|
13
|
-
puts "".ljust(80, "-")
|
14
|
-
puts "Finished in #{duration} seconds."
|
15
|
-
puts
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "base_formatter")
|
2
|
-
|
3
|
-
module MicroTest
|
4
|
-
class MinFormatter < MicroTest::BaseFormatter
|
5
|
-
set_short_name "min"
|
6
|
-
|
7
|
-
def after_suite(test_classes)
|
8
|
-
puts
|
9
|
-
puts "Passed: #{green passed}"
|
10
|
-
puts "Failed: #{red failed}"
|
11
|
-
puts "".ljust(80, "-")
|
12
|
-
puts "Finished in #{duration} seconds."
|
13
|
-
puts
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|