oktest 1.3.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +156 -18
- data/Rakefile.rb +1 -1
- data/benchmark/run_all.rb +1 -0
- data/bin/oktest +3 -0
- data/lib/oktest.rb +253 -143
- data/oktest.gemspec +4 -3
- data/test/{run_all.rb → all.rb} +1 -0
- data/test/assertion_test.rb +244 -229
- data/test/filter_test.rb +123 -120
- data/test/fixture_test.rb +34 -32
- data/test/generator_test.rb +26 -22
- data/test/helper_test.rb +382 -204
- data/test/init.rb +44 -0
- data/test/mainapp_test.rb +249 -199
- data/test/matcher_test.rb +157 -126
- data/test/misc_test.rb +32 -30
- data/test/nanot.rb +307 -0
- data/test/node_test.rb +321 -242
- data/test/reporter_test.rb +250 -208
- data/test/runner_test.rb +102 -100
- data/test/util_test.rb +197 -193
- data/test/utilhelper_test.rb +36 -38
- data/test/visitor_test.rb +55 -50
- metadata +21 -7
- data/test/initialize.rb +0 -21
- data/test/tc.rb +0 -127
data/test/init.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
###
|
5
|
+
### $Release: 1.5.0 $
|
6
|
+
### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
|
7
|
+
### $License: MIT License $
|
8
|
+
###
|
9
|
+
|
10
|
+
File.class_eval do
|
11
|
+
$LOAD_PATH << join(dirname(dirname(expand_path(__FILE__))), 'lib')
|
12
|
+
end
|
13
|
+
|
14
|
+
require_relative './nanot'
|
15
|
+
require 'oktest'
|
16
|
+
|
17
|
+
|
18
|
+
module NanoTest
|
19
|
+
module_function
|
20
|
+
|
21
|
+
def test_when(desc, &b)
|
22
|
+
yield desc
|
23
|
+
end
|
24
|
+
|
25
|
+
def plain2colored(str)
|
26
|
+
str = str.gsub(/<R>(.*?)<\/R>/) { Oktest::Color.red($1) }
|
27
|
+
str = str.gsub(/<G>(.*?)<\/G>/) { Oktest::Color.green($1) }
|
28
|
+
str = str.gsub(/<B>(.*?)<\/B>/) { Oktest::Color.blue($1) }
|
29
|
+
str = str.gsub(/<C>(.*?)<\/C>/) { Oktest::Color.cyan($1) }
|
30
|
+
str = str.gsub(/<M>(.*?)<\/M>/) { Oktest::Color.magenta($1) }
|
31
|
+
str = str.gsub(/<Y>(.*?)<\/Y>/) { Oktest::Color.yellow($1) }
|
32
|
+
str = str.gsub(/<b>(.*?)<\/b>/) { Oktest::Color.bold($1) }
|
33
|
+
str = str.gsub(/<E>(.*?)<\/E>/) { Oktest::Color.red_b($1) }
|
34
|
+
return str
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
# for Ruby 2.4 or older
|
41
|
+
require 'set'
|
42
|
+
unless Set.instance_methods(false).include?(:===)
|
43
|
+
class Set; alias === include?; end
|
44
|
+
end
|