mumuki-gobstones-runner 1.1.0 → 1.2.0
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 +5 -5
- data/lib/assets/boom.png +0 -0
- data/lib/checker.rb +24 -4
- data/lib/expectations_hook.rb +13 -0
- data/lib/locales/en.yml +5 -2
- data/lib/locales/es.yml +3 -0
- data/lib/multiple_executions_runner.rb +12 -0
- data/lib/precompile_hook.rb +5 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c12c74934309e4653afed1d6402e2d8f9474da3d3fd791d7c5ab2f6604cb3c58
|
4
|
+
data.tar.gz: 5967cf219b0575ff14bbc6bbcdfa41878fca2f02b6bfadcabb3cce3cb92adc17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f49274e5da567a2a1a904b7f6cdfcf1797df55e9f94437cf598d97238f4b293455ea954365591c40d769edcf0aaefae3cfb98fecabc19793efbc2cee2381bb8e
|
7
|
+
data.tar.gz: f0bbcfb9c8188fc1849d59826e3e4ddf9819f42c6129438730cdfc1aaa205d9a5b147914cd81059fecddb392a6a73ffbe23e29ef4b39a19082ed45e34bde2e54
|
data/lib/assets/boom.png
ADDED
Binary file
|
data/lib/checker.rb
CHANGED
@@ -62,13 +62,21 @@ module Gobstones
|
|
62
62
|
expected_value: expected
|
63
63
|
} if return_value.nil?
|
64
64
|
|
65
|
-
final_value = return_value
|
65
|
+
final_value = adapt_value return_value
|
66
|
+
final_expected_value = expected
|
67
|
+
|
68
|
+
if return_value[:type] == 'Number'
|
69
|
+
final_value = final_value.to_s
|
70
|
+
final_expected_value = final_expected_value.to_s
|
71
|
+
# TODO: This is not ok but it's here for retrocompatibility issues.
|
72
|
+
end
|
73
|
+
|
66
74
|
fail_with status: :check_return_failed_different_values,
|
67
75
|
result: {
|
68
76
|
initial: result[:initialBoard],
|
69
77
|
expected_value: expected,
|
70
78
|
actual_value: final_value
|
71
|
-
} if final_value !=
|
79
|
+
} if final_value != final_expected_value
|
72
80
|
end
|
73
81
|
|
74
82
|
private
|
@@ -92,10 +100,22 @@ module Gobstones
|
|
92
100
|
end
|
93
101
|
|
94
102
|
def convert_known_reason_code(code)
|
95
|
-
return "no_stones" if code ==
|
96
|
-
return "out_of_board" if code ==
|
103
|
+
return "no_stones" if code == 'cannot-remove-stone'
|
104
|
+
return "out_of_board" if code == 'cannot-move-to'
|
105
|
+
return "unassigned_variable" if code == 'undefined-variable'
|
106
|
+
return "wrong_argument_type" if code.include? 'type-mismatch'
|
107
|
+
return "wrong_arguments_quantity" if code.include? 'arity-mismatch'
|
97
108
|
|
98
109
|
code
|
99
110
|
end
|
111
|
+
|
112
|
+
def adapt_value(return_value)
|
113
|
+
type = return_value[:type]
|
114
|
+
value = return_value[:value]
|
115
|
+
|
116
|
+
return value.to_s.capitalize if type == 'Bool'
|
117
|
+
|
118
|
+
value
|
119
|
+
end
|
100
120
|
end
|
101
121
|
end
|
data/lib/expectations_hook.rb
CHANGED
@@ -11,4 +11,17 @@ class GobstonesExpectationsHook < Mumukit::Templates::MulangExpectationsHook
|
|
11
11
|
ast = output.first[:result][:mulangAst]
|
12
12
|
Mulang::Code.new(mulang_language, ast)
|
13
13
|
end
|
14
|
+
|
15
|
+
def compile_expectations_and_exceptions(request)
|
16
|
+
expectations, exceptions = super request
|
17
|
+
|
18
|
+
subject = request.batch.options[:subject]
|
19
|
+
expectations << { binding: '*', inspection: "Declares:=#{subject}" } if subject
|
20
|
+
|
21
|
+
[expectations, exceptions]
|
22
|
+
end
|
23
|
+
|
24
|
+
def default_smell_exceptions
|
25
|
+
LOGIC_SMELLS + FUNCTIONAL_SMELLS + OBJECT_ORIENTED_SMELLS
|
26
|
+
end
|
14
27
|
end
|
data/lib/locales/en.yml
CHANGED
@@ -6,8 +6,11 @@ en:
|
|
6
6
|
check_error_failed_another_reason: 'The program was expected to fail by <strong>%{expected_code}</strong>, but it failed by another reason.'
|
7
7
|
check_return_failed_different_values: '<strong>%{expected_value}</strong> was expected but <strong>%{actual_value}</strong> was obtained.'
|
8
8
|
check_return_failed_no_return: '<strong>%{expected_value}</strong> was expected but no value was obtained.'
|
9
|
-
code_no_stones: '
|
10
|
-
code_out_of_board: '
|
9
|
+
code_no_stones: 'no stones left'
|
10
|
+
code_out_of_board: 'out of board'
|
11
|
+
code_wrong_argument_type: 'wrong arguments type'
|
12
|
+
code_unassigned_variable: 'unassigned variable'
|
13
|
+
code_wrong_arguments_quantity: 'wrong arguments quantity'
|
11
14
|
expected_board: 'Expected final board'
|
12
15
|
final_board: 'Final board'
|
13
16
|
initial_board: 'Initial board'
|
data/lib/locales/es.yml
CHANGED
@@ -8,6 +8,9 @@ es:
|
|
8
8
|
check_return_failed_no_return: 'Se esperaba <strong>%{expected_value}</strong> pero no se obtuvo ningún valor.'
|
9
9
|
code_no_stones: 'falta de bolitas disponibles'
|
10
10
|
code_out_of_board: 'caída del tablero'
|
11
|
+
code_wrong_argument_type: 'problema de tipos en los argumentos'
|
12
|
+
code_unassigned_variable: 'variable no asignada'
|
13
|
+
code_wrong_arguments_quantity: 'cantidad errónea de argumentos'
|
11
14
|
expected_board: 'Tablero final esperado'
|
12
15
|
final_board: 'Tablero final'
|
13
16
|
initial_board: 'Tablero inicial'
|
@@ -4,6 +4,8 @@ module Gobstones
|
|
4
4
|
execution = output[example[:id]]
|
5
5
|
execution[:status] = execution[:status].to_sym
|
6
6
|
|
7
|
+
convert_compilation_to_runtime_errors! execution if compilation_error?(execution)
|
8
|
+
|
7
9
|
raise Mumukit::Metatest::Errored, error_message(execution) unless success?(execution)
|
8
10
|
execution
|
9
11
|
end
|
@@ -14,6 +16,10 @@ module Gobstones
|
|
14
16
|
[:passed, :runtime_error].include? execution[:status]
|
15
17
|
end
|
16
18
|
|
19
|
+
def compilation_error?(execution)
|
20
|
+
execution[:status] == :compilation_error
|
21
|
+
end
|
22
|
+
|
17
23
|
def error_message(execution)
|
18
24
|
return format execution.except(:result).to_json if execution[:status] != :compilation_error
|
19
25
|
|
@@ -21,6 +27,12 @@ module Gobstones
|
|
21
27
|
format Gobstones.build_error(error)
|
22
28
|
end
|
23
29
|
|
30
|
+
def convert_compilation_to_runtime_errors!(execution)
|
31
|
+
if execution[:result][:finalBoardError][:reason][:code].include? 'arity-mismatch'
|
32
|
+
execution[:status] = :runtime_error
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
24
36
|
def format(error)
|
25
37
|
"<pre>#{error}</pre>"
|
26
38
|
end
|
data/lib/precompile_hook.rb
CHANGED
@@ -13,12 +13,17 @@ class GobstonesPrecompileHook < Mumukit::Templates::FileHook
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def compile(request)
|
16
|
+
add_missing_headers! request
|
16
17
|
file = super request
|
17
18
|
|
18
19
|
struct request.to_h.merge batch: @batch,
|
19
20
|
result: run!(file)
|
20
21
|
end
|
21
22
|
|
23
|
+
def add_missing_headers!(request)
|
24
|
+
request.test.gsub! /(.*(initial_board|final_board).*\n)(?!.*GBB\/1\.0.*)/, "\\1 GBB/1.0\\3\n"
|
25
|
+
end
|
26
|
+
|
22
27
|
def compile_file_content(request)
|
23
28
|
@batch = Gobstones::BatchParser.parse(request)
|
24
29
|
@batch.to_json
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-gobstones-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Alfonso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit
|
@@ -143,6 +143,7 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
+
- lib/assets/boom.png
|
146
147
|
- lib/assets_server.rb
|
147
148
|
- lib/checker.rb
|
148
149
|
- lib/expectations_hook.rb
|
@@ -185,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
186
|
version: '0'
|
186
187
|
requirements: []
|
187
188
|
rubyforge_project:
|
188
|
-
rubygems_version: 2.
|
189
|
+
rubygems_version: 2.7.4
|
189
190
|
signing_key:
|
190
191
|
specification_version: 4
|
191
192
|
summary: Gobstones Runner for Mumuki
|