mumukit 2.34.0 → 2.37.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9beefd9e88deef1875e5ba15e634b0064ad895f0e5d198466c60b6e4f583a343
4
- data.tar.gz: 92dd2f7e10a670859430c4a68f6a4e6fb1b6878f8c37dd55ecb5db809361740a
3
+ metadata.gz: bc343e3684b7298db67776bc5173eca318387a04b1fc24f127c0e2fe33a00a37
4
+ data.tar.gz: cda123be4cfaf6f0fe6f83c33f6f397a6d02e78b3af32d73143b576884d4b498
5
5
  SHA512:
6
- metadata.gz: d1005af685f7b05bd81b3ff292aee75a816eb366f419cbb56dd572af877dac6f92477764ba2ab29cf8cc1f40d7e2d20f00a33651409c4798664114a10b29352e
7
- data.tar.gz: aad024612d60dd94e3bdb2497b48579fd1641c0dea1364f256fa4c00d9ccf060dd6cf37db9c224d60265cc17f2dc9b9f70e90477dfb118fda2e73a8ae5bb7c67
6
+ metadata.gz: c58571a713afbcf18b29ca925697db526232d7d7ccd7b7a885e242929e89aef24387ae94e0cafd7962d2d8ef335c1f646105e9fb0b9b9d00b955fc7924e069df
7
+ data.tar.gz: 1650c1dab328188894024f2a36d1c96f4ed922bd31a89a5419190956f44814eecba35387361da9525890f5991ca00acbe0d7cd5e04a4fe1aa8db9c10df254300
@@ -0,0 +1,17 @@
1
+ es-CL:
2
+ mumukit:
3
+ memory_exceeded: Limite de memoria excedido. ¿Tu programa está alocando demasiada memoria?
4
+ time_exceeded: Limite de tiempo de ejecución de %{limit}s excedido. ¿Tu programa tiene recursión o bucle infinito?
5
+ masked_tempfile_basename: solucion
6
+ interactive:
7
+ check_last_query_equals: "La consulta debería ser '%{expected}' pero fue '%{actual}'"
8
+ check_last_query_fails: "La consulta debería fallar pero pasó"
9
+ check_last_query_matches: "La consulta no cumple con la expresión regular %{regex}"
10
+ check_last_query_outputs: "La consulta debería devolver '%{expected}' pero devolvió '%{actual}'"
11
+ check_last_query_includes: "La consulta debería incluir '%{expected}' pero devolvió '%{actual}'"
12
+ check_last_query_like: "La consulta debería ser como '%{expected}' pero devolvió '%{actual}'"
13
+ check_last_query_passes: "La consulta debería pasar pero falló"
14
+ check_query_fails: "La consulta '%{query}' debería fallar pero pasó"
15
+ check_query_outputs: "La consulta '%{query}' debería devolver '%{expected}' pero devolvió '%{actual}'"
16
+ check_query_passes: "La consulta '%{query}' debería pasar pero falló"
17
+ goal_passed: "El objetivo se cumplió exitosamente"
@@ -1,7 +1,7 @@
1
1
  es:
2
2
  mumukit:
3
3
  memory_exceeded: Limite de memoria excedido. ¿Tu programa está alocando demasiada memoria?
4
- time_exceeded: Limite de tiempo de ejecución de %{limit}s excedido. ¿Tu programa tiene recursión o bucle infinito?
4
+ time_exceeded: Limite de tiempo de ejecución de %{limit}s excedido. ¿Tu programa tiene recursión o bucle infinito?
5
5
  masked_tempfile_basename: solucion
6
6
  interactive:
7
7
  check_last_query_equals: "La consulta debería ser '%{expected}' pero fue '%{actual}'"
@@ -14,4 +14,4 @@ es:
14
14
  check_query_fails: "La consulta '%{query}' debería fallar pero pasó"
15
15
  check_query_outputs: "La consulta '%{query}' debería devolver '%{expected}' pero devolvió '%{actual}'"
16
16
  check_query_passes: "La consulta '%{query}' debería pasar pero falló"
17
- goal_passed: "El objetivo se cumplió exitosamente"
17
+ goal_passed: "El objetivo se cumplió exitosamente"
@@ -1,9 +1,13 @@
1
1
  require 'mumukit/core'
2
2
  require 'mumukit/directives'
3
+ require 'mumukit/inspection'
3
4
  require 'ostruct'
5
+ require 'mulang'
4
6
 
5
7
  I18n.load_translations_path File.join(__dir__, 'locales', '*.yml')
6
8
 
9
+ Mulang::Inspection.register_extension! Mumukit::Inspection::Source
10
+
7
11
  module Mumukit
8
12
  def self.current_runner=(runner)
9
13
  @current_runner = runner
@@ -1,11 +1,17 @@
1
1
  class Mumukit::Explainer
2
+ include Mumukit::WithContentType
3
+
2
4
  def explain(content, test_results)
5
+ content_type.enumerate(explanations(content, test_results))
6
+ end
7
+
8
+ private
9
+
10
+ def explanations(content, test_results)
3
11
  explain_methods
4
12
  .map { |selector, key| eval_explain(selector, key, content, test_results) }
5
13
  .compact
6
14
  .map { |explain| I18n.t(explain[:key], explain[:binding]) }
7
- .map { |it| "* #{it}" }
8
- .join("\n")
9
15
  end
10
16
 
11
17
  def eval_explain(selector, key, content, test_results)
@@ -3,6 +3,7 @@ end
3
3
 
4
4
  require_relative './metatest/errors'
5
5
  require_relative './metatest/checker'
6
+ require_relative './metatest/test_result_builder'
6
7
  require_relative './metatest/interactive_checker'
7
8
  require_relative './metatest/framework'
8
- require_relative './metatest/identity_runner'
9
+ require_relative './metatest/identity_runner'
@@ -24,10 +24,12 @@ module Mumukit::Metatest
24
24
  ## }
25
25
  ##
26
26
  def check(input, example)
27
+ builder = Mumukit::Metatest::TestResultBuilder.new
28
+
27
29
  check_assertions input, postconditions_for(example), example
28
- [example[:name], :passed, render_success_output(input)]
30
+ build_passed_test_result builder, example, input
29
31
  rescue => e
30
- [example[:name], :failed, render_error_output(input, e.message)]
32
+ build_failed_test_result builder, example, input, e
31
33
  end
32
34
 
33
35
  ## If no postconditions are included in the example,
@@ -36,12 +38,34 @@ module Mumukit::Metatest
36
38
  example[:postconditions] || example.except(:name)
37
39
  end
38
40
 
39
- def render_success_output(value)
41
+ # Implementors may override this method instead of `build_success_output`
42
+ # if they don't want to handle error details.
43
+ #
44
+ # This method is only for backward compatibility. New code
45
+ # should use `build_success_output`.
46
+ def render_success_output(_input)
40
47
  nil
41
48
  end
42
49
 
43
- def render_error_output(value, error)
44
- error
50
+ # Implementors may override this method instead of `build_error_output`
51
+ # if they don't want to handle error details.
52
+ #
53
+ # This method is only for backward compatibility. New code
54
+ # should use `build_error_output`.
55
+ def render_error_output(_input, error_message)
56
+ error_message
57
+ end
58
+
59
+ # Implementors should override this method if they want access to
60
+ # the error details and produce more complex test results
61
+ def build_success_output(builder, _example, input)
62
+ builder.result = render_success_output input
63
+ end
64
+
65
+ # Implementors should override this method if they want access to
66
+ # the error details and produce more complex test results
67
+ def build_error_output(builder, _example, input, error)
68
+ builder.result = render_error_output input, error.message
45
69
  end
46
70
 
47
71
  def check_assertions(input, assertions_hash, example)
@@ -54,16 +78,30 @@ module Mumukit::Metatest
54
78
  send "check_#{assertion_name}", input, assertion_config
55
79
  end
56
80
 
57
- def fail(message)
58
- raise Mumukit::Metatest::Failed, message
81
+ def fail(message, details: nil)
82
+ raise Mumukit::Metatest::Failed.new(message, details)
83
+ end
84
+
85
+ def abort(message, details: nil)
86
+ raise Mumukit::Metatest::Aborted.new(message, details)
87
+ end
88
+
89
+ def error(message, details: nil)
90
+ raise Mumukit::Metatest::Errored.new(message, details)
59
91
  end
60
92
 
61
- def abort(message)
62
- raise Mumukit::Metatest::Aborted, message
93
+ def build_passed_test_result(builder, example, input)
94
+ builder.title = example[:name]
95
+ builder.status = :passed
96
+ build_success_output builder, example, input
97
+ builder.build
63
98
  end
64
99
 
65
- def error(message)
66
- raise Mumukit::Metatest::Errored, message
100
+ def build_failed_test_result(builder, example, input, e)
101
+ builder.title = example[:name]
102
+ builder.status = :failed
103
+ build_error_output builder, example, input, e
104
+ builder.build
67
105
  end
68
106
  end
69
107
  end
@@ -1,10 +1,17 @@
1
1
  module Mumukit::Metatest
2
- class Aborted < StandardError
2
+ class BaseError < StandardError
3
+ attr_reader :details
4
+ def initialize(message = "", details = nil)
5
+ super(message)
6
+ @details = details
7
+ end
8
+ end
9
+ class Aborted < BaseError
3
10
  end
4
11
 
5
- class Errored < StandardError
12
+ class Errored < BaseError
6
13
  end
7
14
 
8
- class Failed < StandardError
15
+ class Failed < BaseError
9
16
  end
10
- end
17
+ end
@@ -0,0 +1,20 @@
1
+ module Mumukit::Metatest
2
+ class TestResultBuilder
3
+ attr_accessor :title, :status, :result, :summary_type, :summary_message
4
+
5
+ def summary
6
+ {type: summary_type.presence, message: summary_message.presence}.compact
7
+ end
8
+
9
+ def build
10
+ raise 'missing status' unless status
11
+ raise "invalid #{status}" unless status.passed? || status.failed?
12
+
13
+ if summary_message.present? || summary_type.present?
14
+ [title, status, result, summary]
15
+ else
16
+ [title, status, result]
17
+ end
18
+ end
19
+ end
20
+ end
@@ -58,10 +58,16 @@ class Mumukit::Server::ResponseBuilder
58
58
  end
59
59
 
60
60
  def structured_base_response(test_results)
61
- {testResults: test_results[0].map { |title, status, result|
62
- {title: title,
63
- status: status,
64
- result: result} }}
61
+ {
62
+ testResults: test_results[0].map do |title, status, result, summary|
63
+ { summary: summary&.compact.presence }
64
+ .compact
65
+ .merge(
66
+ title: title,
67
+ status: status,
68
+ result: result)
69
+ end
70
+ }
65
71
  end
66
72
 
67
73
  def unstructured_base_response(test_results)
@@ -1,3 +1,3 @@
1
1
  module Mumukit
2
- VERSION = '2.34.0'
2
+ VERSION = '2.37.1'
3
3
  end
metadata CHANGED
@@ -1,63 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.34.0
4
+ version: 2.37.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-23 00:00:00.000000000 Z
11
+ date: 2020-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '1.7'
20
- - - "<"
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: '3'
19
+ version: '2.0'
23
20
  type: :development
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '1.7'
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '3'
26
+ version: '2.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: rake
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: '10.0'
33
+ version: '12.3'
40
34
  type: :development
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
38
  - - "~>"
45
39
  - !ruby/object:Gem::Version
46
- version: '10.0'
40
+ version: '12.3'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: rspec
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '2'
47
+ version: '3.0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
52
  - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: '2'
54
+ version: '3.0'
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: codeclimate-test-reporter
63
57
  requirement: !ruby/object:Gem::Requirement
@@ -176,14 +170,14 @@ dependencies:
176
170
  requirements:
177
171
  - - "~>"
178
172
  - !ruby/object:Gem::Version
179
- version: '0.46'
173
+ version: '0.71'
180
174
  type: :runtime
181
175
  prerelease: false
182
176
  version_requirements: !ruby/object:Gem::Requirement
183
177
  requirements:
184
178
  - - "~>"
185
179
  - !ruby/object:Gem::Version
186
- version: '0.46'
180
+ version: '0.71'
187
181
  - !ruby/object:Gem::Dependency
188
182
  name: sinatra-cross_origin
189
183
  requirement: !ruby/object:Gem::Requirement
@@ -214,6 +208,20 @@ dependencies:
214
208
  version: '3.2'
215
209
  - !ruby/object:Gem::Dependency
216
210
  name: mulang
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '5.1'
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '5.1'
223
+ - !ruby/object:Gem::Dependency
224
+ name: mumukit-inspection
217
225
  requirement: !ruby/object:Gem::Requirement
218
226
  requirements:
219
227
  - - "~>"
@@ -258,22 +266,16 @@ dependencies:
258
266
  name: mumukit-content-type
259
267
  requirement: !ruby/object:Gem::Requirement
260
268
  requirements:
261
- - - ">="
262
- - !ruby/object:Gem::Version
263
- version: '0.2'
264
- - - "<"
269
+ - - "~>"
265
270
  - !ruby/object:Gem::Version
266
- version: '2'
271
+ version: '1.10'
267
272
  type: :runtime
268
273
  prerelease: false
269
274
  version_requirements: !ruby/object:Gem::Requirement
270
275
  requirements:
271
- - - ">="
272
- - !ruby/object:Gem::Version
273
- version: '0.2'
274
- - - "<"
276
+ - - "~>"
275
277
  - !ruby/object:Gem::Version
276
- version: '2'
278
+ version: '1.10'
277
279
  description: Helpers for building a Mumuki Test Server
278
280
  email:
279
281
  - flbulgarelli@yahoo.com.ar
@@ -283,6 +285,7 @@ extra_rdoc_files: []
283
285
  files:
284
286
  - bin/limit
285
287
  - lib/locales/en.yml
288
+ - lib/locales/es-CL.yml
286
289
  - lib/locales/es.yml
287
290
  - lib/locales/pt.yml
288
291
  - lib/mumukit.rb
@@ -309,6 +312,7 @@ files:
309
312
  - lib/mumukit/metatest/framework.rb
310
313
  - lib/mumukit/metatest/identity_runner.rb
311
314
  - lib/mumukit/metatest/interactive_checker.rb
315
+ - lib/mumukit/metatest/test_result_builder.rb
312
316
  - lib/mumukit/request_validation_error.rb
313
317
  - lib/mumukit/runner.rb
314
318
  - lib/mumukit/runtime.rb
@@ -365,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
365
369
  - !ruby/object:Gem::Version
366
370
  version: '0'
367
371
  requirements: []
368
- rubygems_version: 3.0.6
372
+ rubygems_version: 3.0.3
369
373
  signing_key:
370
374
  specification_version: 4
371
375
  summary: Mumuki Test Server Development Kit