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/generator_test.rb
CHANGED
@@ -1,17 +1,21 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
1
4
|
###
|
2
|
-
### $Release: 1.
|
5
|
+
### $Release: 1.5.0 $
|
3
6
|
### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
|
4
7
|
### $License: MIT License $
|
5
8
|
###
|
6
9
|
|
7
|
-
require_relative './
|
10
|
+
require_relative './init'
|
8
11
|
|
9
12
|
require 'stringio'
|
10
13
|
|
11
14
|
|
12
|
-
class
|
15
|
+
class TestGenerator__Test
|
16
|
+
extend NanoTest
|
13
17
|
|
14
|
-
|
18
|
+
INPUT_3 = <<'END'
|
15
19
|
class Hello
|
16
20
|
def hello(name=nil)
|
17
21
|
#; default name is 'world'.
|
@@ -24,10 +28,10 @@ class Hello
|
|
24
28
|
end
|
25
29
|
END
|
26
30
|
|
27
|
-
|
28
|
-
|
31
|
+
test_target 'Oktest::TestGenerator#parse()' do
|
32
|
+
test_subject "[!5mzd3] parses ruby code." do
|
29
33
|
g = Oktest::TestGenerator.new()
|
30
|
-
tree = g.parse(StringIO.new(
|
34
|
+
tree = g.parse(StringIO.new(INPUT_3))
|
31
35
|
expected = [
|
32
36
|
["", "class", "Hello", [
|
33
37
|
[" ", "def", "#hello", [
|
@@ -36,14 +40,14 @@ END
|
|
36
40
|
]]
|
37
41
|
]]
|
38
42
|
]
|
39
|
-
|
43
|
+
test_eq? tree, expected
|
40
44
|
end
|
41
45
|
end
|
42
46
|
|
43
|
-
|
44
|
-
|
47
|
+
test_target 'Oktest::TestGenerator#transform()' do
|
48
|
+
test_subject "[!te7zw] converts tree into test code." do
|
45
49
|
g = Oktest::TestGenerator.new()
|
46
|
-
tree = g.parse(StringIO.new(
|
50
|
+
tree = g.parse(StringIO.new(INPUT_3))
|
47
51
|
code = g.transform(tree, 1)
|
48
52
|
expected = <<'END'
|
49
53
|
|
@@ -56,16 +60,16 @@ END
|
|
56
60
|
|
57
61
|
spec "returns greeting message."
|
58
62
|
|
59
|
-
end
|
63
|
+
end
|
60
64
|
|
61
65
|
|
62
66
|
end # Hello
|
63
67
|
END
|
64
|
-
|
68
|
+
test_eq? code, expected
|
65
69
|
end
|
66
|
-
|
70
|
+
test_subject "[!q5duk] supports 'unaryop' style option." do
|
67
71
|
g = Oktest::TestGenerator.new('unaryop')
|
68
|
-
tree = g.parse(StringIO.new(
|
72
|
+
tree = g.parse(StringIO.new(INPUT_3))
|
69
73
|
code = g.transform(tree, 1)
|
70
74
|
expected = <<'END'
|
71
75
|
|
@@ -78,19 +82,19 @@ END
|
|
78
82
|
|
79
83
|
- spec("returns greeting message.")
|
80
84
|
|
81
|
-
end
|
85
|
+
end
|
82
86
|
|
83
87
|
|
84
88
|
end # Hello
|
85
89
|
END
|
86
|
-
|
90
|
+
test_eq? code, expected
|
87
91
|
end
|
88
92
|
end
|
89
93
|
|
90
|
-
|
91
|
-
|
94
|
+
test_target 'Oktest::TestGenerator#generate()' do
|
95
|
+
test_subject "[!5hdw4] generates test code." do
|
92
96
|
g = Oktest::TestGenerator.new()
|
93
|
-
code = g.generate(StringIO.new(
|
97
|
+
code = g.generate(StringIO.new(INPUT_3))
|
94
98
|
expected = <<'END'
|
95
99
|
# coding: utf-8
|
96
100
|
|
@@ -108,7 +112,7 @@ Oktest.scope do
|
|
108
112
|
|
109
113
|
spec "returns greeting message."
|
110
114
|
|
111
|
-
end
|
115
|
+
end
|
112
116
|
|
113
117
|
|
114
118
|
end # Hello
|
@@ -116,7 +120,7 @@ Oktest.scope do
|
|
116
120
|
|
117
121
|
end
|
118
122
|
END
|
119
|
-
|
123
|
+
test_eq? code, expected
|
120
124
|
end
|
121
125
|
end
|
122
126
|
|