stones-spec 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/example.rb +4 -5
- data/lib/gobstones.rb +4 -4
- data/lib/postcondition/expected_boom.rb +5 -5
- data/lib/postcondition/postcondition.rb +2 -2
- data/lib/renderers/with_gbb_html_rendering.rb +6 -2
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 419391e54ed1047656c6f0f417db08074fbb3241
|
4
|
+
data.tar.gz: f24b4027a7173413e189c8c30b23b1fb7ddaf743
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79a108be5be884ebd3b19776bccce710470022f98d20fc7704c641aa67838f74702c3c09d6eb4dd470c006c88349ac1f2810dd38f557290f11b5d76698ea4606
|
7
|
+
data.tar.gz: 237acb241cd0534972c6e1a24abddd048169ec7be91ccea4cff5bc3114ce640c5a3f479e67ea892fcd6772a8eddafdbabfa2139d81374c05230418c222e6b6c3
|
data/lib/example.rb
CHANGED
@@ -19,12 +19,11 @@ module StonesSpec
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def result(files, execution, postcondition)
|
22
|
-
if execution[:status] == :
|
23
|
-
raise Gobstones::SyntaxError, execution[:result]
|
24
|
-
end
|
25
|
-
|
26
|
-
if execution[:status] == :runtime_error
|
22
|
+
if execution[:status] == :aborted
|
27
23
|
raise Gobstones::AbortedError, execution[:result]
|
24
|
+
|
25
|
+
if execution[:status] == :syntax_error
|
26
|
+
raise Gobstones::SyntaxError, execution[:result]
|
28
27
|
end
|
29
28
|
|
30
29
|
postcondition.validate(files[:initial_board].open.read, files[:final_board].open.read, execution[:result], execution[:status])
|
data/lib/gobstones.rb
CHANGED
@@ -11,15 +11,15 @@ module StonesSpec
|
|
11
11
|
class Error < Exception
|
12
12
|
end
|
13
13
|
|
14
|
-
class
|
14
|
+
class AbortedError < Error
|
15
15
|
def status
|
16
|
-
:
|
16
|
+
:aborted
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
class
|
20
|
+
class SyntaxError < Error
|
21
21
|
def status
|
22
|
-
:
|
22
|
+
:errored
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -11,8 +11,8 @@ module StonesSpec
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def validate(initial_board_gbb, actual_final_board_gbb, result, status)
|
14
|
-
if status == :failed
|
15
|
-
check_right_error_type initial_board_gbb, result
|
14
|
+
if status == :failed || status == :unknown_error
|
15
|
+
check_right_error_type initial_board_gbb, result, status
|
16
16
|
else
|
17
17
|
boards = [['Tablero inicial', initial_board_gbb], ['Tablero final', actual_final_board_gbb]]
|
18
18
|
make_boards_output example.title, boards, :failed, failure_message
|
@@ -21,11 +21,11 @@ module StonesSpec
|
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
-
def check_right_error_type(initial_board_gbb, result)
|
24
|
+
def check_right_error_type(initial_board_gbb, result, status)
|
25
25
|
if error_type_matches? result
|
26
|
-
[example.title, :passed, make_error_output(result, initial_board_gbb)]
|
26
|
+
[example.title, :passed, make_error_output(result, status, initial_board_gbb)]
|
27
27
|
else
|
28
|
-
[example.title, :failed, "#{invalid_boom_type_message}\n#{make_error_output(result, initial_board_gbb)}"]
|
28
|
+
[example.title, :failed, "#{invalid_boom_type_message}\n#{make_error_output(result, status, initial_board_gbb)}"]
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -20,8 +20,8 @@ module StonesSpec
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def validate(initial_board_gbb, actual_final_board_gbb, result, status)
|
23
|
-
if status == :failed
|
24
|
-
[example.title, :failed, make_error_output(result, initial_board_gbb)]
|
23
|
+
if status == :failed || status == :unknown_error
|
24
|
+
[example.title, :failed, make_error_output(result, status, initial_board_gbb)]
|
25
25
|
else
|
26
26
|
validate_expected_result(initial_board_gbb, actual_final_board_gbb, result)
|
27
27
|
end
|
@@ -4,8 +4,12 @@ module StonesSpec
|
|
4
4
|
HtmlBoardRenderer.new(caption: caption).render(Stones::GbbReader.new.from_string gbb_representation)
|
5
5
|
end
|
6
6
|
|
7
|
-
def make_error_output(result, initial_board_gbb)
|
8
|
-
|
7
|
+
def make_error_output(result, status, initial_board_gbb)
|
8
|
+
if status == :failed
|
9
|
+
"#{get_html_board 'Tablero inicial', initial_board_gbb}\n#{get_boom_board initial_board_gbb}\n#{result}"
|
10
|
+
else
|
11
|
+
result
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
def make_boards_output(title, gbb_boards, status, extra = nil)
|
data/lib/version.rb
CHANGED