oktest 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,19 +2,20 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  ###
5
- ### $Release: 1.4.0 $
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 './initialize'
10
+ require_relative './init'
11
11
 
12
12
  require 'stringio'
13
13
 
14
14
 
15
- class TestGenerator_TC < TC
15
+ class TestGenerator__Test
16
+ extend NanoTest
16
17
 
17
- INPUT = <<END
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
- describe '#parse()' do
31
- it "[!5mzd3] parses ruby code." do
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(INPUT))
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
- assert_eq tree, expected
43
+ test_eq? tree, expected
43
44
  end
44
45
  end
45
46
 
46
- describe '#transform()' do
47
- it "[!te7zw] converts tree into test code." do
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(INPUT))
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
- assert_eq code, expected
68
+ test_eq? code, expected
68
69
  end
69
- it "[!q5duk] supports 'unaryop' style option." do
70
+ test_subject "[!q5duk] supports 'unaryop' style option." do
70
71
  g = Oktest::TestGenerator.new('unaryop')
71
- tree = g.parse(StringIO.new(INPUT))
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
- assert_eq code, expected
90
+ test_eq? code, expected
90
91
  end
91
92
  end
92
93
 
93
- describe '#generate()' do
94
- it "[!5hdw4] generates test code." do
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(INPUT))
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
- assert_eq code, expected
123
+ test_eq? code, expected
123
124
  end
124
125
  end
125
126