oktest 1.4.0 → 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 +42 -5
- data/Rakefile.rb +1 -1
- data/lib/oktest.rb +32 -9
- data/oktest.gemspec +3 -3
- data/test/assertion_test.rb +229 -227
- data/test/filter_test.rb +122 -120
- data/test/fixture_test.rb +33 -32
- data/test/generator_test.rb +20 -19
- data/test/helper_test.rb +280 -274
- data/test/init.rb +44 -0
- data/test/mainapp_test.rb +194 -190
- data/test/matcher_test.rb +156 -126
- data/test/misc_test.rb +31 -30
- data/test/nanot.rb +307 -0
- data/test/node_test.rb +296 -252
- data/test/reporter_test.rb +249 -208
- data/test/runner_test.rb +101 -100
- data/test/util_test.rb +196 -193
- data/test/utilhelper_test.rb +35 -38
- data/test/visitor_test.rb +54 -50
- metadata +10 -10
- data/test/initialize.rb +0 -22
- data/test/tc.rb +0 -128
- /data/test/{run_all.rb → all.rb} +0 -0
data/test/generator_test.rb
CHANGED
@@ -2,19 +2,20 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
###
|
5
|
-
### $Release: 1.
|
5
|
+
### $Release: 1.5.0 $
|
6
6
|
### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
|
7
7
|
### $License: MIT License $
|
8
8
|
###
|
9
9
|
|
10
|
-
require_relative './
|
10
|
+
require_relative './init'
|
11
11
|
|
12
12
|
require 'stringio'
|
13
13
|
|
14
14
|
|
15
|
-
class
|
15
|
+
class TestGenerator__Test
|
16
|
+
extend NanoTest
|
16
17
|
|
17
|
-
|
18
|
+
INPUT_3 = <<'END'
|
18
19
|
class Hello
|
19
20
|
def hello(name=nil)
|
20
21
|
#; default name is 'world'.
|
@@ -27,10 +28,10 @@ class Hello
|
|
27
28
|
end
|
28
29
|
END
|
29
30
|
|
30
|
-
|
31
|
-
|
31
|
+
test_target 'Oktest::TestGenerator#parse()' do
|
32
|
+
test_subject "[!5mzd3] parses ruby code." do
|
32
33
|
g = Oktest::TestGenerator.new()
|
33
|
-
tree = g.parse(StringIO.new(
|
34
|
+
tree = g.parse(StringIO.new(INPUT_3))
|
34
35
|
expected = [
|
35
36
|
["", "class", "Hello", [
|
36
37
|
[" ", "def", "#hello", [
|
@@ -39,14 +40,14 @@ END
|
|
39
40
|
]]
|
40
41
|
]]
|
41
42
|
]
|
42
|
-
|
43
|
+
test_eq? tree, expected
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
46
|
-
|
47
|
-
|
47
|
+
test_target 'Oktest::TestGenerator#transform()' do
|
48
|
+
test_subject "[!te7zw] converts tree into test code." do
|
48
49
|
g = Oktest::TestGenerator.new()
|
49
|
-
tree = g.parse(StringIO.new(
|
50
|
+
tree = g.parse(StringIO.new(INPUT_3))
|
50
51
|
code = g.transform(tree, 1)
|
51
52
|
expected = <<'END'
|
52
53
|
|
@@ -64,11 +65,11 @@ END
|
|
64
65
|
|
65
66
|
end # Hello
|
66
67
|
END
|
67
|
-
|
68
|
+
test_eq? code, expected
|
68
69
|
end
|
69
|
-
|
70
|
+
test_subject "[!q5duk] supports 'unaryop' style option." do
|
70
71
|
g = Oktest::TestGenerator.new('unaryop')
|
71
|
-
tree = g.parse(StringIO.new(
|
72
|
+
tree = g.parse(StringIO.new(INPUT_3))
|
72
73
|
code = g.transform(tree, 1)
|
73
74
|
expected = <<'END'
|
74
75
|
|
@@ -86,14 +87,14 @@ END
|
|
86
87
|
|
87
88
|
end # Hello
|
88
89
|
END
|
89
|
-
|
90
|
+
test_eq? code, expected
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
93
|
-
|
94
|
-
|
94
|
+
test_target 'Oktest::TestGenerator#generate()' do
|
95
|
+
test_subject "[!5hdw4] generates test code." do
|
95
96
|
g = Oktest::TestGenerator.new()
|
96
|
-
code = g.generate(StringIO.new(
|
97
|
+
code = g.generate(StringIO.new(INPUT_3))
|
97
98
|
expected = <<'END'
|
98
99
|
# coding: utf-8
|
99
100
|
|
@@ -119,7 +120,7 @@ Oktest.scope do
|
|
119
120
|
|
120
121
|
end
|
121
122
|
END
|
122
|
-
|
123
|
+
test_eq? code, expected
|
123
124
|
end
|
124
125
|
end
|
125
126
|
|