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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72793b2dccb8f134095ab24f92d04d153092e928
4
- data.tar.gz: d6fe2155fc7ef0dc412f8774bcf2ff1538f88dab
3
+ metadata.gz: 419391e54ed1047656c6f0f417db08074fbb3241
4
+ data.tar.gz: f24b4027a7173413e189c8c30b23b1fb7ddaf743
5
5
  SHA512:
6
- metadata.gz: de3cdcecbae535a69ce3492fe7c4c7f6b6723ccc9efada2924a2e6ea7d7b053cbfe910ee5057f52cf3ab87be47e1b1a191a56d1efd755b35f4252efeb4e9d76b
7
- data.tar.gz: 433f6e70859e948f3c7217a54bc813bf22597562e00759a259b38694953530228f031c336b6b9559c89c22848dabb0027da004d608b3e63e00f77a8f9d8dcd1a
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] == :compilation_error
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 SyntaxError < Error
14
+ class AbortedError < Error
15
15
  def status
16
- :errored
16
+ :aborted
17
17
  end
18
18
  end
19
19
 
20
- class AbortedError < Error
20
+ class SyntaxError < Error
21
21
  def status
22
- :aborted
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
- "#{get_html_board 'Tablero inicial', initial_board_gbb}\n#{get_boom_board initial_board_gbb}\n#{result}"
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
@@ -1,3 +1,3 @@
1
1
  module StonesSpec
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stones-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mumuki