oktest 1.1.1 → 1.2.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 +197 -22
- data/Rakefile.rb +5 -2
- data/benchmark/Rakefile.rb +4 -0
- data/lib/oktest.rb +170 -58
- data/oktest.gemspec +3 -3
- data/test/assertion_test.rb +1 -1
- data/test/filter_test.rb +1 -1
- data/test/fixture_test.rb +14 -1
- data/test/generator_test.rb +1 -1
- data/test/helper_test.rb +3 -3
- data/test/initialize.rb +1 -1
- data/test/mainapp_test.rb +59 -43
- data/test/matcher_test.rb +1 -1
- data/test/misc_test.rb +5 -5
- data/test/node_test.rb +27 -4
- data/test/reporter_test.rb +30 -31
- data/test/runner_test.rb +8 -17
- data/test/tc.rb +12 -0
- data/test/util_test.rb +71 -1
- data/test/utilhelper_test.rb +84 -0
- data/test/visitor_test.rb +1 -1
- metadata +4 -3
data/test/util_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 1.
|
4
|
+
### $Release: 1.2.0 $
|
5
5
|
### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
|
6
6
|
### $License: MIT License $
|
7
7
|
###
|
@@ -74,6 +74,15 @@ END
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
+
describe '.keyword_param_names_of_block()' do
|
78
|
+
it "[!p6qqp] returns keyword param names of proc object." do
|
79
|
+
pr = proc {|a, b=nil, c: nil, d: 1| nil }
|
80
|
+
assert_eq keyword_param_names_of_block(pr), [:c, :d]
|
81
|
+
pr = proc {|a, b=nil| nil }
|
82
|
+
assert_eq keyword_param_names_of_block(pr), []
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
77
86
|
describe '.strfold()' do
|
78
87
|
it "[!wb7m8] returns string as it is if string is not long." do
|
79
88
|
s = "*" * 79
|
@@ -253,6 +262,67 @@ END
|
|
253
262
|
end
|
254
263
|
end
|
255
264
|
|
265
|
+
describe '.partial_regexp!()' do
|
266
|
+
it "[!peyu4] returns PartialRegexp object which inspect string is function call styel." do
|
267
|
+
pattern_str = <<'HEREDOC'
|
268
|
+
* [Date] {== \d\d\d\d-\d\d-\d\d ==}
|
269
|
+
* [Secret] {== [0-9a-f]{8} ==}
|
270
|
+
HEREDOC
|
271
|
+
prexp = Oktest::Util.partial_regexp!(pattern_str)
|
272
|
+
assert_eq prexp.class, Oktest::Util::PartialRegexp
|
273
|
+
assert_eq prexp.pattern_string, pattern_str
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
describe '.partial_regexp()' do
|
278
|
+
it "[!ostkw] raises error if mark has no space or has more than two spaces." do
|
279
|
+
assert_exc(ArgumentError, "\"{====}\": mark should contain only one space (ex: `{== ==}`).") do
|
280
|
+
Oktest::Util.partial_regexp("xxx", '\A', '\z', "{====}")
|
281
|
+
end
|
282
|
+
assert_exc(ArgumentError, "\"{= == =}\": mark should contain only one space (ex: `{== ==}`).") do
|
283
|
+
Oktest::Util.partial_regexp("xxx", '', '', "{= == =}")
|
284
|
+
end
|
285
|
+
end
|
286
|
+
it "[!wn524] returns PartialRegexp object which inspect string is regexp literal style." do
|
287
|
+
pattern_str = <<'HEREDOC'
|
288
|
+
* [Date] {== \d\d\d\d-\d\d-\d\d ==}
|
289
|
+
* [Secret] {== [0-9a-f]{8} ==}
|
290
|
+
HEREDOC
|
291
|
+
prexp = Oktest::Util.partial_regexp(pattern_str)
|
292
|
+
assert_eq prexp.class, Oktest::Util::PartialRegexp
|
293
|
+
assert_eq prexp.pattern_string, nil
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
end
|
298
|
+
|
299
|
+
describe Oktest::Util::PartialRegexp do
|
300
|
+
describe '#inspect()' do
|
301
|
+
it "[!uyh31] returns function call style string if @pattern_string is set." do
|
302
|
+
prexp = Oktest::Util.partial_regexp!(<<'HEREHERE')
|
303
|
+
* [Date] {== \d\d\d\d-\d\d-\d\d ==}
|
304
|
+
* [Secret] {== [0-9a-f]{8} ==}
|
305
|
+
HEREHERE
|
306
|
+
assert_eq prexp.inspect, <<'HEREHERE'
|
307
|
+
partial_regexp(<<PREXP, '\A', '\z')
|
308
|
+
* [Date] {== \d\d\d\d-\d\d-\d\d ==}
|
309
|
+
* [Secret] {== [0-9a-f]{8} ==}
|
310
|
+
PREXP
|
311
|
+
HEREHERE
|
312
|
+
end
|
313
|
+
it "[!ts9v4] returns regexp literal style string if @pattern_string is not set." do
|
314
|
+
prexp = Oktest::Util.partial_regexp(<<'HEREHERE')
|
315
|
+
* [Date] {== \d\d\d\d-\d\d-\d\d ==}
|
316
|
+
* [Secret] {== [0-9a-f]{8} ==}
|
317
|
+
HEREHERE
|
318
|
+
assert_eq prexp.inspect, <<'HEREHERE'.chomp
|
319
|
+
/\A
|
320
|
+
\*\ \[Date\]\ \ \ \ \d\d\d\d-\d\d-\d\d\n
|
321
|
+
\*\ \[Secret\]\ \ [0-9a-f]{8}\n
|
322
|
+
\z/x
|
323
|
+
HEREHERE
|
324
|
+
end
|
325
|
+
end
|
256
326
|
end
|
257
327
|
|
258
328
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
###
|
4
|
+
### $Release: 1.2.0 $
|
5
|
+
### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
|
6
|
+
### $License: MIT License $
|
7
|
+
###
|
8
|
+
|
9
|
+
require_relative './initialize'
|
10
|
+
|
11
|
+
|
12
|
+
class UtilHelper_TC < TC
|
13
|
+
|
14
|
+
describe Oktest::UtilHelper do
|
15
|
+
|
16
|
+
describe '#partial_regexp!()' do
|
17
|
+
pat = <<'END'
|
18
|
+
* [Date] {== \d\d\d\d-\d\d-\d\d ==}
|
19
|
+
* [Secret] {== [0-9a-f]{12} ==}
|
20
|
+
END
|
21
|
+
it "[!9drtn] is available in both topic and spec blocks." do
|
22
|
+
r1 = nil; r2 = nil
|
23
|
+
Oktest.scope do
|
24
|
+
topic "topic" do
|
25
|
+
r1 = partial_regexp!(pat, '\A', '\z')
|
26
|
+
spec "spec" do
|
27
|
+
r2 = partial_regexp!(pat, "", "")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
capture { Oktest.run() }
|
32
|
+
assert_eq r1.class, Oktest::Util::PartialRegexp
|
33
|
+
assert_eq r2.class, Oktest::Util::PartialRegexp
|
34
|
+
assert_eq r1.inspect, <<'END'
|
35
|
+
partial_regexp(<<PREXP, '\A', '\z')
|
36
|
+
* [Date] {== \d\d\d\d-\d\d-\d\d ==}
|
37
|
+
* [Secret] {== [0-9a-f]{12} ==}
|
38
|
+
PREXP
|
39
|
+
END
|
40
|
+
assert_eq r2.inspect, <<'END'
|
41
|
+
partial_regexp(<<PREXP, "", "")
|
42
|
+
* [Date] {== \d\d\d\d-\d\d-\d\d ==}
|
43
|
+
* [Secret] {== [0-9a-f]{12} ==}
|
44
|
+
PREXP
|
45
|
+
END
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#partial_regexp()' do
|
50
|
+
it "[!wo4hp] is available in both topic and spec blocks." do
|
51
|
+
pat = <<'END'
|
52
|
+
* [Date] {== \d\d\d\d-\d\d-\d\d ==}
|
53
|
+
* [Secret] {== [0-9a-f]{12} ==}
|
54
|
+
END
|
55
|
+
r1 = nil; r2 = nil
|
56
|
+
Oktest.scope do
|
57
|
+
topic "topic" do
|
58
|
+
r1 = partial_regexp(pat, '\A', '\z')
|
59
|
+
spec "spec" do
|
60
|
+
r2 = partial_regexp(pat, "", "")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
capture { Oktest.run() }
|
65
|
+
assert_eq r1.class, Oktest::Util::PartialRegexp
|
66
|
+
assert_eq r2.class, Oktest::Util::PartialRegexp
|
67
|
+
assert_eq r1.inspect, <<'END'.chomp
|
68
|
+
/\A
|
69
|
+
\*\ \[Date\]\ \ \ \ \d\d\d\d-\d\d-\d\d\n
|
70
|
+
\*\ \[Secret\]\ \ [0-9a-f]{12}\n
|
71
|
+
\z/x
|
72
|
+
END
|
73
|
+
assert_eq r2.inspect, <<'END'.chomp
|
74
|
+
/
|
75
|
+
\*\ \[Date\]\ \ \ \ \d\d\d\d-\d\d-\d\d\n
|
76
|
+
\*\ \[Secret\]\ \ [0-9a-f]{12}\n
|
77
|
+
/x
|
78
|
+
END
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
data/test/visitor_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oktest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kwatch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- test/runner_test.rb
|
79
79
|
- test/tc.rb
|
80
80
|
- test/util_test.rb
|
81
|
+
- test/utilhelper_test.rb
|
81
82
|
- test/visitor_test.rb
|
82
83
|
homepage: https://github.com/kwatch/oktest/tree/ruby
|
83
84
|
licenses:
|
@@ -91,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
92
|
requirements:
|
92
93
|
- - ">="
|
93
94
|
- !ruby/object:Gem::Version
|
94
|
-
version: '2.
|
95
|
+
version: '2.0'
|
95
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
97
|
requirements:
|
97
98
|
- - ">="
|