micro_test 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95b18d1f0d146dbda392fada14c0d687ee85b703
4
- data.tar.gz: 34d42a85bac2b5eb1c909383fdd92068f3f4c5ab
3
+ metadata.gz: fd22c7f9552ec38ce6adfe5585e6574e3d0581a6
4
+ data.tar.gz: 0e3164eb689caf970bb3a185e6135291dc1118df
5
5
  SHA512:
6
- metadata.gz: 56ecea611b376a6ad4f02e457b722597dc340a85597c96409a3769816812479909bbc1514837e0cd585bee5073f3e28b9cf9fe00f769786ac90983daf20f0b04
7
- data.tar.gz: 0d983415c067420fbb43ba964695576a099d56e1fbcf1a3061f709e426a59a1651d2f9a2383f3800d9d8aca968e96e6a06946403f93fac5ed35194628b5248d3
6
+ metadata.gz: 3cc237556e64b1f411303529ef7b587a4ac4a3cb37247cc6ebd6741d63af52afb57877feba44fa3b1f4511923bc642bef6776a89b95391c3171a46cb6590154a
7
+ data.tar.gz: 79a6947c147939cd34325e10473eed715d88938cc18325aa37f9ad40c1d20c39f7b2a107f995c1e81512c79e252878905556f143c92b7c560bd858655facee91
data/bin/mt CHANGED
@@ -84,7 +84,13 @@ end
84
84
 
85
85
  # setup the formatter ---------------------------------------------------------
86
86
  formatter = MicroTest.formatters.find { |f| f.short_name == options[:formatter] }
87
- formatter ||= MicroTest.formatters.find { |f| f.short_name == "default" }
87
+ formatter ||= begin
88
+ if options[:async]
89
+ MicroTest.formatters.find { |f| f.short_name == "default_async" }
90
+ else
91
+ MicroTest.formatters.find { |f| f.short_name == "default" }
92
+ end
93
+ end
88
94
 
89
95
  # setup the test runner -------------------------------------------------------
90
96
  runner = MicroTest::Runner.new(formatter.new, options)
@@ -95,43 +101,30 @@ if options[:pry]
95
101
  begin
96
102
  require "pry"
97
103
  require "pry-stack_explorer"
104
+ require "pry-rescue"
98
105
  rescue Exception => e
99
106
  puts red(e.message)
100
107
  puts e.backtrace.join("\n")
101
108
  puts red("This can be caused when pry-stack_explorer isn't specified in the Gemfile.")
102
109
  puts red("It might also indicate that pry-stack_explorer & pry are out of sync.")
103
- puts red("If your Gemfile is in good shape, try uninstalling the most recent version of pry.")
110
+ puts red("Try different cominations of GEM versions for pry & pry-stack_explorer.")
104
111
  exit 1
105
112
  end
106
113
 
107
114
  Pry.config.hooks.add_hook :before_session, :print_instructions do |_, _, _pry_|
108
- _pry_.commands.create_command "line", "View the assert line that failed." do
109
- def process
110
- stack = caller.dup
111
- unwanted_stack = stack.select do |line|
112
- line =~ /pry-nav|pry-debugger/
113
- end
114
- if unwanted_stack.empty?
115
- _pry_.run_command "up"
116
- else
117
- _pry_.run_command "up #{unwanted_stack.size + 1}"
118
- end
119
- end
120
- end
121
-
122
- puts "".ljust(80, "-")
123
- puts " Pry session started"
124
- puts "".ljust(80, "-")
125
- puts " - Type #{yellow "line"} to see the line that failed."
126
- puts " If #{yellow "line"} doesn't work for you, use #{yellow "up"} & #{yellow "down"} to navigate the stack."
127
115
  puts
128
- puts " - Type #{yellow "whereami"} if running with pry-rescue and an unhandled exception"
129
- puts " started the pry session."
116
+ puts " Pry session started"
117
+ puts gray("".ljust(80, "-"))
118
+ puts " #{gray "Test Failures:"} Type #{green "up"} to see the line that failed"
119
+ puts " #{gray "Exceptions:"} Type #{green "whereami"} to get your bearings"
130
120
  puts
131
- puts " - Type #{yellow "exit"} or #{blue "<CTL-D>"} to continue"
132
- puts "".ljust(80, "-")
121
+ puts " Type #{green "exit"} or #{green "<CTL-D>"} to continue"
122
+ puts gray("".ljust(80, "-"))
133
123
  puts
134
124
  end
125
+
126
+ exit Pry.rescue { runner.run }
127
+ else
128
+ exit runner.run
135
129
  end
136
130
 
137
- exit runner.run
@@ -16,6 +16,7 @@ begin
16
16
  puts "Installing pry and pry-stack_explorer."
17
17
  installer.install "pry"
18
18
  installer.install "pry-stack_explorer"
19
+ installer.install "pry-rescue"
19
20
  else
20
21
  puts "Platform is java... skip install for pry and pry-stack_explorer."
21
22
  end
@@ -9,7 +9,8 @@ module MicroTest
9
9
  :blue => 34,
10
10
  :magenta => 35,
11
11
  :cyan => 36,
12
- :white => 37
12
+ :white => 37,
13
+ :gray => 90
13
14
  }
14
15
 
15
16
  colors.each do |name, code|
@@ -65,10 +65,10 @@ module MicroTest
65
65
  start = 0 if start <= 0
66
66
  finish = index + 2
67
67
  finish = assert[:lines].length - 1 if finish >= assert[:lines].length
68
- print_assert_failure_lines assert, start, finish
68
+ print_assert_failure_lines assert, start, finish, index
69
69
  end
70
70
 
71
- def print_assert_failure_lines(assert, start, finish)
71
+ def print_assert_failure_lines(assert, start, finish, index)
72
72
  (start..finish).each do |i|
73
73
  print "".ljust(9)
74
74
  if i == index
@@ -67,10 +67,10 @@ module MicroTest
67
67
  start = 0 if start <= 0
68
68
  finish = index + 2
69
69
  finish = assert[:lines].length - 1 if finish >= assert[:lines].length
70
- print_assert_failure_lines assert, start, finish
70
+ print_assert_failure_lines assert, start, finish, index
71
71
  end
72
72
 
73
- def print_assert_failure_lines(assert, start, finish)
73
+ def print_assert_failure_lines(assert, start, finish, index)
74
74
  (start..finish).each do |i|
75
75
  print "".ljust(9)
76
76
  if i == index
@@ -1,3 +1,3 @@
1
1
  module MicroTest
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -16,6 +16,7 @@ if ENV["MT_DEMO"]
16
16
  end
17
17
 
18
18
  test "fibonacci recursion 3" do
19
+ raise
19
20
  @count.times { |i| TestCPULatency.fib(i) }
20
21
  assert true
21
22
  end
metadata CHANGED
@@ -1,45 +1,86 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: micro_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Hopkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-05 00:00:00.000000000 Z
11
+ date: 2014-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: The Sinatra of testing frameworks. Its also known as microtest, micro
42
- test, & micro_test.
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry-stack_explorer
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-rescue
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: The Sinatra of testing frameworks.
43
84
  email:
44
85
  - natehop@gmail.com
45
86
  executables:
@@ -48,7 +89,9 @@ extensions:
48
89
  - ext/mkrf_conf.rb
49
90
  extra_rdoc_files: []
50
91
  files:
92
+ - bin/mt
51
93
  - ext/mkrf_conf.rb
94
+ - lib/micro_test.rb
52
95
  - lib/micro_test/color.rb
53
96
  - lib/micro_test/formatters/base_formatter.rb
54
97
  - lib/micro_test/formatters/default_async_formatter.rb
@@ -60,8 +103,6 @@ files:
60
103
  - lib/micro_test/test.rb
61
104
  - lib/micro_test/test_wrapper.rb
62
105
  - lib/micro_test/version.rb
63
- - lib/micro_test.rb
64
- - bin/mt
65
106
  - test/color_test.rb
66
107
  - test/cpu_latency_test.rb
67
108
  - test/fail_test.rb
@@ -79,21 +120,20 @@ require_paths:
79
120
  - lib
80
121
  required_ruby_version: !ruby/object:Gem::Requirement
81
122
  requirements:
82
- - - '>='
123
+ - - ">="
83
124
  - !ruby/object:Gem::Version
84
125
  version: 1.9.2
85
126
  required_rubygems_version: !ruby/object:Gem::Requirement
86
127
  requirements:
87
- - - '>='
128
+ - - ">="
88
129
  - !ruby/object:Gem::Version
89
130
  version: '0'
90
131
  requirements: []
91
132
  rubyforge_project:
92
- rubygems_version: 2.0.3
133
+ rubygems_version: 2.2.0
93
134
  signing_key:
94
135
  specification_version: 4
95
- summary: The Sinatra of testing frameworks. Its also known as microtest, micro test,
96
- & micro_test.
136
+ summary: The Sinatra of testing frameworks.
97
137
  test_files:
98
138
  - test/color_test.rb
99
139
  - test/cpu_latency_test.rb
@@ -102,4 +142,3 @@ test_files:
102
142
  - test/runner_test.rb
103
143
  - test/test_test.rb
104
144
  - test/test_wrapper_test.rb
105
- has_rdoc: