mumukit 2.34.1 → 2.38.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/locales/es-CL.yml +17 -0
- data/lib/locales/es.yml +2 -2
- data/lib/mumukit/explainer.rb +8 -2
- data/lib/mumukit/metatest.rb +2 -1
- data/lib/mumukit/metatest/checker.rb +49 -11
- data/lib/mumukit/metatest/errors.rb +11 -4
- data/lib/mumukit/metatest/test_result_builder.rb +20 -0
- data/lib/mumukit/server/response_builder.rb +10 -4
- data/lib/mumukit/templates/mulang_expectations_hook.rb +13 -8
- data/lib/mumukit/version.rb +1 -1
- metadata +23 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3876e1a398e3f2e0cf33f7aa1a4df85979cca7ffef37b4070d5344c2072e952
|
4
|
+
data.tar.gz: 9dcde120df168b2898461e08cb08ca26c219fdaf0791bc38a133891a7dba51ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6863a908811d9df5f390827c8c3fdea11d0c3de67b07435658d037d8b5ba9ae9d9c13cb92236bbab0e29bf942d7d668468112295ca1ce9f6cda2312cc1e0c328
|
7
|
+
data.tar.gz: 2ab1f2822e74a9b7c0a628f4661749a6e1d87e2c69c833844a34cc434ba626e61026a7f61e554a8dfccd9dc60e414b1836ad143fbfeafcbc2199e3b01801e63c
|
@@ -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"
|
data/lib/locales/es.yml
CHANGED
@@ -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:
|
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"
|
data/lib/mumukit/explainer.rb
CHANGED
@@ -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)
|
data/lib/mumukit/metatest.rb
CHANGED
@@ -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
|
-
|
30
|
+
build_passed_test_result builder, example, input
|
29
31
|
rescue => e
|
30
|
-
|
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
|
-
|
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
|
-
|
44
|
-
|
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,
|
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
|
62
|
-
|
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
|
66
|
-
|
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
|
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 <
|
12
|
+
class Errored < BaseError
|
6
13
|
end
|
7
14
|
|
8
|
-
class Failed <
|
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
|
-
{
|
62
|
-
|
63
|
-
|
64
|
-
|
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)
|
@@ -2,12 +2,12 @@ require 'mulang'
|
|
2
2
|
|
3
3
|
module Mumukit
|
4
4
|
class Templates::MulangExpectationsHook < Mumukit::Templates::ExpectationsHook
|
5
|
-
LOGIC_SMELLS =
|
6
|
-
FUNCTIONAL_SMELLS =
|
7
|
-
OBJECT_ORIENTED_SMELLS =
|
8
|
-
IMPERATIVE_SMELLS =
|
9
|
-
EXPRESSIVENESS_SMELLS =
|
10
|
-
GENERIC_SMELLS =
|
5
|
+
LOGIC_SMELLS = Mulang::Expectation::LOGIC_SMELLS
|
6
|
+
FUNCTIONAL_SMELLS = Mulang::Expectation::FUNCTIONAL_SMELLS
|
7
|
+
OBJECT_ORIENTED_SMELLS = Mulang::Expectation::OBJECT_ORIENTED_SMELLS
|
8
|
+
IMPERATIVE_SMELLS = Mulang::Expectation::IMPERATIVE_SMELLS
|
9
|
+
EXPRESSIVENESS_SMELLS = Mulang::Expectation::EXPRESSIVENESS_SMELLS
|
10
|
+
GENERIC_SMELLS = Mulang::Expectation::GENERIC_SMELLS
|
11
11
|
|
12
12
|
required :language, 'You have to provide a Mulang-compatible language in order to use this hook'
|
13
13
|
|
@@ -16,14 +16,15 @@ module Mumukit
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def compile_mulang_analysis(request, expectations)
|
19
|
-
mulang_code(request).analysis(
|
19
|
+
mulang_code(request).analysis({
|
20
20
|
expectations: expectations[:ast],
|
21
21
|
customExpectations: expectations[:custom],
|
22
22
|
smellsSet: {
|
23
23
|
tag: 'AllSmells',
|
24
24
|
exclude: (expectations[:exceptions] + default_smell_exceptions)
|
25
25
|
},
|
26
|
-
domainLanguage: domain_language
|
26
|
+
domainLanguage: domain_language
|
27
|
+
}.merge({normalizationOptions: normalization_options(request).presence}.compact))
|
27
28
|
end
|
28
29
|
|
29
30
|
def run_mulang_analysis(analysis)
|
@@ -41,6 +42,10 @@ module Mumukit
|
|
41
42
|
}
|
42
43
|
end
|
43
44
|
|
45
|
+
def normalization_options(request)
|
46
|
+
request.dig(:settings, :normalization_options) || {}
|
47
|
+
end
|
48
|
+
|
44
49
|
def default_smell_exceptions
|
45
50
|
[]
|
46
51
|
end
|
data/lib/mumukit/version.rb
CHANGED
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.
|
4
|
+
version: 2.38.0
|
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:
|
11
|
+
date: 2021-01-20 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: '
|
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: '
|
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: '
|
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: '
|
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: '
|
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: '
|
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.
|
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.
|
180
|
+
version: '0.71'
|
187
181
|
- !ruby/object:Gem::Dependency
|
188
182
|
name: sinatra-cross_origin
|
189
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,28 +212,28 @@ dependencies:
|
|
218
212
|
requirements:
|
219
213
|
- - "~>"
|
220
214
|
- !ruby/object:Gem::Version
|
221
|
-
version: '
|
215
|
+
version: '6.0'
|
222
216
|
type: :runtime
|
223
217
|
prerelease: false
|
224
218
|
version_requirements: !ruby/object:Gem::Requirement
|
225
219
|
requirements:
|
226
220
|
- - "~>"
|
227
221
|
- !ruby/object:Gem::Version
|
228
|
-
version: '
|
222
|
+
version: '6.0'
|
229
223
|
- !ruby/object:Gem::Dependency
|
230
224
|
name: mumukit-inspection
|
231
225
|
requirement: !ruby/object:Gem::Requirement
|
232
226
|
requirements:
|
233
227
|
- - "~>"
|
234
228
|
- !ruby/object:Gem::Version
|
235
|
-
version: '
|
229
|
+
version: '6.0'
|
236
230
|
type: :runtime
|
237
231
|
prerelease: false
|
238
232
|
version_requirements: !ruby/object:Gem::Requirement
|
239
233
|
requirements:
|
240
234
|
- - "~>"
|
241
235
|
- !ruby/object:Gem::Version
|
242
|
-
version: '
|
236
|
+
version: '6.0'
|
243
237
|
- !ruby/object:Gem::Dependency
|
244
238
|
name: mumukit-core
|
245
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -272,22 +266,16 @@ dependencies:
|
|
272
266
|
name: mumukit-content-type
|
273
267
|
requirement: !ruby/object:Gem::Requirement
|
274
268
|
requirements:
|
275
|
-
- - "
|
276
|
-
- !ruby/object:Gem::Version
|
277
|
-
version: '0.2'
|
278
|
-
- - "<"
|
269
|
+
- - "~>"
|
279
270
|
- !ruby/object:Gem::Version
|
280
|
-
version: '
|
271
|
+
version: '1.10'
|
281
272
|
type: :runtime
|
282
273
|
prerelease: false
|
283
274
|
version_requirements: !ruby/object:Gem::Requirement
|
284
275
|
requirements:
|
285
|
-
- - "
|
286
|
-
- !ruby/object:Gem::Version
|
287
|
-
version: '0.2'
|
288
|
-
- - "<"
|
276
|
+
- - "~>"
|
289
277
|
- !ruby/object:Gem::Version
|
290
|
-
version: '
|
278
|
+
version: '1.10'
|
291
279
|
description: Helpers for building a Mumuki Test Server
|
292
280
|
email:
|
293
281
|
- flbulgarelli@yahoo.com.ar
|
@@ -297,6 +285,7 @@ extra_rdoc_files: []
|
|
297
285
|
files:
|
298
286
|
- bin/limit
|
299
287
|
- lib/locales/en.yml
|
288
|
+
- lib/locales/es-CL.yml
|
300
289
|
- lib/locales/es.yml
|
301
290
|
- lib/locales/pt.yml
|
302
291
|
- lib/mumukit.rb
|
@@ -323,6 +312,7 @@ files:
|
|
323
312
|
- lib/mumukit/metatest/framework.rb
|
324
313
|
- lib/mumukit/metatest/identity_runner.rb
|
325
314
|
- lib/mumukit/metatest/interactive_checker.rb
|
315
|
+
- lib/mumukit/metatest/test_result_builder.rb
|
326
316
|
- lib/mumukit/request_validation_error.rb
|
327
317
|
- lib/mumukit/runner.rb
|
328
318
|
- lib/mumukit/runtime.rb
|
@@ -379,8 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
379
369
|
- !ruby/object:Gem::Version
|
380
370
|
version: '0'
|
381
371
|
requirements: []
|
382
|
-
|
383
|
-
rubygems_version: 2.7.7
|
372
|
+
rubygems_version: 3.0.3
|
384
373
|
signing_key:
|
385
374
|
specification_version: 4
|
386
375
|
summary: Mumuki Test Server Development Kit
|