質問編集履歴
1
ご指摘いただいた点を「```」で囲み、見やすくなるよう試みました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,8 +10,6 @@
|
|
10
10
|
|
11
11
|
エラーメッセージ
|
12
12
|
|
13
|
-
```
|
14
|
-
|
15
13
|
Failure:
|
16
14
|
|
17
15
|
ConvertHashSyntaxTest#test_convert_hash_syntax [C:(フォルダの場所)/test/convert_hash_syntax_test.rb:20]:
|
@@ -20,25 +18,25 @@
|
|
20
18
|
|
21
19
|
Actual: "{\n :name => \"Alice\",\n :age=>20,\n :gender => :female\n}\n"
|
22
20
|
|
21
|
+
```
|
22
|
+
|
23
|
+
|
24
|
+
|
23
25
|
### 該当のソースコード
|
24
26
|
|
25
27
|
|
26
28
|
|
27
|
-
```ここに言語名を入力
|
28
|
-
|
29
|
-
ソースコード
|
30
|
-
|
31
29
|
```
|
32
30
|
|
33
|
-
require "minitest/autorun"
|
31
|
+
require "minitest/autorun"
|
34
32
|
|
35
|
-
require "../lib/convert_hash_syntax"
|
33
|
+
require "../lib/convert_hash_syntax"
|
36
34
|
|
37
35
|
|
38
36
|
|
39
|
-
class ConvertHashSyntaxTest < Minitest::Test
|
37
|
+
class ConvertHashSyntaxTest < Minitest::Test
|
40
38
|
|
41
|
-
def test_convert_hash_syntax
|
39
|
+
def test_convert_hash_syntax
|
42
40
|
|
43
41
|
old_syntax = <<~TEXT
|
44
42
|
|
@@ -52,9 +50,9 @@
|
|
52
50
|
|
53
51
|
}
|
54
52
|
|
55
|
-
TEXT
|
53
|
+
TEXT
|
56
54
|
|
57
|
-
expected = <<~TEXT
|
55
|
+
expected = <<~TEXT
|
58
56
|
|
59
57
|
{
|
60
58
|
|
@@ -66,13 +64,17 @@
|
|
66
64
|
|
67
65
|
}
|
68
66
|
|
69
|
-
TEXT
|
67
|
+
TEXT
|
70
68
|
|
71
|
-
assert_equal expected, convert_hash_syntax(old_syntax)
|
69
|
+
assert_equal expected, convert_hash_syntax(old_syntax)
|
72
70
|
|
73
|
-
end
|
71
|
+
end
|
74
72
|
|
75
|
-
end
|
73
|
+
end
|
74
|
+
|
75
|
+
```
|
76
|
+
|
77
|
+
|
76
78
|
|
77
79
|
### 試したこと
|
78
80
|
|
@@ -82,14 +84,20 @@
|
|
82
84
|
|
83
85
|
### 補足情報(FW/ツールのバージョンなど)
|
84
86
|
|
87
|
+
|
88
|
+
|
85
89
|
Ruby 2.7.2
|
86
90
|
|
87
91
|
visual studio codeを使用
|
88
92
|
|
93
|
+
```
|
94
|
+
|
89
|
-
def convert_hash_syntax(old_syntax)
|
95
|
+
def convert_hash_syntax(old_syntax)
|
90
96
|
|
91
97
|
old_syntax.gsub(/:(\w+)*=>* /,"\1: ")
|
92
98
|
|
93
|
-
end
|
99
|
+
end
|
100
|
+
|
101
|
+
```
|
94
102
|
|
95
103
|
にて、ハッシュ記法変換プログラムは入力済みの状況になります。
|