cutest-cj 1.5.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cutest +1 -0
  3. data/lib/cutest.rb +25 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d08f45b9e558dde6ec839072b93f58f5ed29fb84
4
- data.tar.gz: fc4edc999c4408f8e62d051c42dd8362b93619e4
3
+ metadata.gz: 456b761581b8d51f94fbdf6579ffa33c2d20409c
4
+ data.tar.gz: 98e36c06af46526235073984496c6590b83bd8a4
5
5
  SHA512:
6
- metadata.gz: 51e704634edf40673dcae803cc88474618cc692cbee517e083a6a1e250a72a74c36b7abd19acb34f0140265472b22ac3bc3b0325a64f4f293c8fe1fb4518f292
7
- data.tar.gz: a5beaf0f1a6c1c7b7e9ff6c62a947652a59cb7e0440aa2cb0f9ee11e5e78b2d5fbe32132e1837dadd4e50e1935534141e372159b41b9e204e34f377009b1db12
6
+ metadata.gz: 77578fa5641ba20d8c391cd10b4582c41a940a6c5b9061a6e24495f4a35873a944778ffc89cb35651370e165dba6d90decd6b9008a6c7359d3b782e12c03e4a6
7
+ data.tar.gz: a691abf3485f5be697a004c18cdb8c09ec6b06865deaa70039363607f9779438f2ec1e211201b9d0b1bc03374a7f183f4e9e5fbd699e77f6eb9b7ce133ad17d2
data/bin/cutest CHANGED
@@ -15,6 +15,7 @@ files = Clap.run ARGV,
15
15
  "-r" => lambda { |file| require file },
16
16
  "-t" => lambda { |name| cutest[:only] = name },
17
17
  "-s" => lambda { |name| cutest[:scope] = name },
18
+ "-a" => lambda { cutest[:all_tests] = true },
18
19
  "-w" => lambda { |name| cutest[:warnings] = true },
19
20
  "-b" => lambda { cutest[:backtrace] = true },
20
21
  "-p" => lambda {
data/lib/cutest.rb CHANGED
@@ -7,7 +7,7 @@ class Cutest
7
7
  autoload :Database, 'cutest/database'
8
8
 
9
9
  unless defined?(VERSION)
10
- VERSION = "1.5.1"
10
+ VERSION = "1.6.0"
11
11
  FILTER = %r[/(ruby|jruby|rbx)[-/]([0-9\.])+]
12
12
  CACHE = Hash.new { |h, k| h[k] = File.readlines(k) }
13
13
  end
@@ -224,6 +224,29 @@ module Kernel
224
224
  # inside test blocks), it is necessary to wrap them in test blocks in order
225
225
  # to execute preparation and setup blocks.
226
226
  def test(name = nil, &block)
227
+ if !cutest[:all_tests]
228
+ run_test name, &block
229
+ else
230
+ begin
231
+ run_test name, &block
232
+ rescue LoadError, SyntaxError
233
+ display_error
234
+ exit 1
235
+
236
+ rescue StandardError
237
+ puts ''
238
+ trace = $!.backtrace
239
+
240
+ puts " \e[93mTest: \e[0m%s\e[31m✘\e[0m\n" % (cutest[:test] != '' ? "#{cutest[:test]} " : '')
241
+
242
+ Cutest.display_trace(trace.first)
243
+
244
+ Cutest.display_error
245
+ end
246
+ end
247
+ end
248
+
249
+ def run_test name = nil, &block
227
250
  cutest[:test] = name
228
251
 
229
252
  if !cutest[:only] || cutest[:only] == name
@@ -274,6 +297,6 @@ module Kernel
274
297
 
275
298
  # Executed when an assertion succeeds.
276
299
  def success
277
- print ""
300
+ print "\033[32m•\033[0m"
278
301
  end
279
302
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cutest-cj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Janowski
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-07-21 00:00:00.000000000 Z
13
+ date: 2014-07-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: pry