mumukit 2.44.0 → 2.46.0

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: 027a4f91a42c7b90c17b418228e73956f751f707e51d6ded4c4802126f25d1c4
4
- data.tar.gz: e6fe7203e99fecf139597da9b5c833717b49af81a1cd5402d05fd6d752f9e7f3
3
+ metadata.gz: 4373e0933cc618f5296133f601a28fc2a32497f072ebcef924bdb54757d54d5c
4
+ data.tar.gz: b31b3f50fa6e859b7815fc75d7da804b72146eceb35c3dff7c5b7558c5c61c23
5
5
  SHA512:
6
- metadata.gz: cc83fce40d4e6c02abbdc0fb05dbc481d8eab5538d4cd7109646a853cc2b4f88e168569857eafe02be21c7a76fb2e3214d7a048b49f170563c5c07f6a2eaecc8
7
- data.tar.gz: 67ab25ad98d772145044d999bcc6af135d314c5102293b3604fcfb4c50dc0e34ef4d1fe6d9ddde428999a73fadd40a5942fd5a2f0905be59f3266b5543544ede
6
+ metadata.gz: e58de2ec660e81837568e02e13a1b2f7cb86f9fde5b607a761a130354df7bb7fa5acf364bb14a8819edc69c349f6a3c70a5e1ee98e627563d193935d7a7ff756
7
+ data.tar.gz: 8536f6834bc8c8d643084701c1cc509772b35780a9a3a89ea7c69ba57e23021a5961cf01fb9b13fd90bbcab0f105a6f6484b60ba18646916cbab63421f68da26
data/lib/locales/en.yml CHANGED
@@ -5,14 +5,15 @@ en:
5
5
  masked_tempfile_basename: solution
6
6
  interactive:
7
7
  check_last_query_equals: "query should be '%{expected}' but was '%{actual}'"
8
- check_last_query_fails: "query should fail but it passed"
9
- check_last_query_matches: "query does not match regexp %{regexp}"
8
+ check_last_query_fails: "query should fail but it was '%{actual}' and passed"
9
+ check_last_query_matches: "query should match regexp %{regexp}, but was '%{actual}'"
10
10
  check_last_query_outputs: "query output should be '%{expected}' but was '%{actual}'"
11
- check_last_query_includes: "query output should include '%{expected}' but was '%{actual}'"
12
- check_last_query_like: "query output should be like '%{expected}' but was '%{actual}'"
13
- check_last_query_passes: "query should pass but it failed"
11
+ check_last_query_output_includes: "query output should include '%{expected}' but was '%{actual}'"
12
+ check_last_query_output_like: "query output should be like '%{expected}' but was '%{actual}'"
13
+ check_last_query_passes: "query should pass but it was '%{actual}' and failed"
14
14
  check_query_fails: "query '%{query}' should fail but it passed"
15
15
  check_query_outputs: "query '%{query}' output should be '%{expected}' but was '%{actual}'"
16
16
  check_query_passes: "query '%{query}' should pass but it failed"
17
17
  goal_passed: "goal was met successfully"
18
- check_queries_match: "All the required queries must be executed"
18
+ check_queries_match: "All the required queries must be executed. Executed %{all} but only %{matches} match the expectations"
19
+ check_queries_equal: "All the required queries must be executed. Executed %{all} but only %{matches} match the expectations"
@@ -5,14 +5,15 @@ es-CL:
5
5
  masked_tempfile_basename: solucion
6
6
  interactive:
7
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 %{regexp}"
8
+ check_last_query_fails: "La consulta debería fallar pero fue '%{actual}' y pasó"
9
+ check_last_query_matches: "La consulta debería cumplir con la expresión regular '%{regexp}' pero fue '%{actual}'"
10
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ó"
11
+ check_last_query_output_includes: "El retorno de la consulta debería incluir '%{expected}' pero devolvió '%{actual}'"
12
+ check_last_query_output_like: "El retorno de la consulta debería ser como '%{expected}' pero devolvió '%{actual}'"
13
+ check_last_query_passes: "La consulta debería pasar pero fue '%{actual}' y falló"
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
17
  goal_passed: "El objetivo se cumplió exitosamente"
18
- check_queries_match: "Se deben realizar todas las consultas solicitadas"
18
+ check_queries_match: "Se deben realizar todas las consultas solicitadas. Se ejecutaron %{all} pero sólo %{matches} coinciden con las solicitadas"
19
+ check_queries_equal: "Se deben realizar todas las consultas solicitadas. Se ejecutaron %{all} pero sólo %{matches} coinciden con las solicitadas"
data/lib/locales/es.yml CHANGED
@@ -5,14 +5,15 @@ es:
5
5
  masked_tempfile_basename: solucion
6
6
  interactive:
7
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 %{regexp}"
8
+ check_last_query_fails: "La consulta debería fallar pero fue '%{actual}' y pasó"
9
+ check_last_query_matches: "La consulta debería cumplir con la expresión regular '%{regexp}' pero fue '%{actual}'"
10
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ó"
11
+ check_last_query_output_includes: "El retorno de la consulta debería incluir '%{expected}' pero devolvió '%{actual}'"
12
+ check_last_query_output_like: "El retorno de la consulta debería ser como '%{expected}' pero devolvió '%{actual}'"
13
+ check_last_query_passes: "La consulta debería pasar pero fue '%{actual}' y falló"
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
- check_queries_match: "Se deben realizar todas las consultas solicitadas"
18
17
  goal_passed: "El objetivo se cumplió exitosamente"
18
+ check_queries_match: "Se deben realizar todas las consultas solicitadas. Se ejecutaron %{all} pero sólo %{matches} coinciden con las solicitadas"
19
+ check_queries_equal: "Se deben realizar todas las consultas solicitadas. Se ejecutaron %{all} pero sólo %{matches} coinciden con las solicitadas"
data/lib/locales/pt.yml CHANGED
@@ -5,14 +5,15 @@ pt:
5
5
  masked_tempfile_basename: solução
6
6
  interactive:
7
7
  check_last_query_equals: "a consulta deve ser '%{expected}' mas foi '%{actual}'"
8
- check_last_query_fails: "a consulta deve falhar, mas passou"
9
- check_last_query_matches: "A consulta não corresponde a regex %{regexp}"
8
+ check_last_query_fails: "a consulta deve falhar, mas foi '%{actual}' e passou"
9
+ check_last_query_matches: "A consulta deve corresponder a regex %{regexp} mas foi '%{actual}'"
10
10
  check_last_query_outputs: "O resultado da consulta deve ser '%{expected}', mas foi '%{actual}'"
11
- check_last_query_includes: "O resultado da consulta deve incluir '%{expected}', mas foi '%{actual}'"
12
- check_last_query_like: "O resultado da consulta deve ser como '%{expected}', mas foi '%{actual}'"
13
- check_last_query_passes: "A consulta deve passar, mas falhou"
11
+ check_last_query_output_includes: "O resultado da consulta deve incluir '%{expected}', mas foi '%{actual}'"
12
+ check_last_query_output_like: "O resultado da consulta deve ser como '%{expected}', mas foi '%{actual}'"
13
+ check_last_query_passes: "A consulta deve passar, mas foi '%{actual}' e falhou"
14
14
  check_query_fails: "a consulta '%{query}' deve falhar, mas passou"
15
15
  check_query_outputs: "a consulta '%{query}' deve ser '%{expected}', mas foi '%{actual}'"
16
16
  check_query_passes: "a consulta '%{query}' deve passar, mas falhou"
17
- check_queries_match: "Todas as consultas solicitadas devem ser feitas"
17
+ check_queries_match: "Todas as consultas solicitadas devem ser feitas. %{all} foram feitas mas só %{matches} correspondem com as solicitadas"
18
+ check_queries_equal: "Todas as consultas solicitadas devem ser feitas. %{all} foram feitas mas só %{matches} correspondem com as solicitadas"
18
19
  goal_passed: "O objetivo foi alcançado com sucesso"
@@ -14,18 +14,27 @@ module Mumukit::Metatest
14
14
 
15
15
  def check_last_query_matches(_result, goal)
16
16
  regexp = goal[:regexp]
17
- fail_t :check_last_query_matches, regexp: regexp.inspect unless query.match?(regexp)
17
+ actual = query
18
+ fail_t :check_last_query_matches, regexp: regexp.inspect, actual: actual unless query.match?(regexp)
18
19
  end
19
20
 
20
21
  def check_last_query_fails(result, _goal)
21
- fail_t :check_last_query_fails unless result[:query][:status].failed?
22
+ actual = query
23
+ fail_t :check_last_query_fails, actual: actual unless result[:query][:status].failed?
24
+ end
25
+
26
+ def check_queries_equal(result, goal)
27
+ matches = goal[:values].map do |value|
28
+ queries.find { |query| query == value }
29
+ end.compact
30
+ fail_queries_t :check_queries_equal, queries, matches, goal[:values]
22
31
  end
23
32
 
24
33
  def check_queries_match(result, goal)
25
- queries = [query] + @request.cookie.to_a
26
- fail_t :check_queries_match unless goal[:regexps].all? do |regexp|
27
- queries.any? { |query| query.match? regexp }
28
- end
34
+ matches = goal[:regexps].map do |regexp|
35
+ queries.find { |query| query.match? regexp }
36
+ end.compact
37
+ fail_queries_t :check_queries_match, queries, matches, goal[:regexps]
29
38
  end
30
39
 
31
40
  def check_last_query_outputs(result, goal)
@@ -47,7 +56,8 @@ module Mumukit::Metatest
47
56
  end
48
57
 
49
58
  def check_last_query_passes(result, _goal)
50
- fail_t :check_last_query_passes unless result[:query][:status].passed?
59
+ actual = query
60
+ fail_t :check_last_query_passes, actual: actual unless result[:query][:status].passed?
51
61
  end
52
62
 
53
63
  def check_query_passes(result, goal)
@@ -82,9 +92,39 @@ module Mumukit::Metatest
82
92
 
83
93
  private
84
94
 
95
+ def join_queries(queries)
96
+ queries.map { |it| "`#{it}`" }.join(", ").presence || '**∅**'
97
+ end
98
+
99
+ def fail_queries_t(key, queries, matches, expectations)
100
+ fail_t key, all: join_queries(queries), matches: join_queries(matches) unless matches.size == expectations.size
101
+ end
102
+
85
103
  def query
86
- query_s = @request.query.to_s
87
- @strip_mode == :right_only ? query_s.rstrip : query_s.strip
104
+ strip @request.query.to_s
105
+ end
106
+
107
+ def cookie
108
+ @request.cookie.to_a.map { |it| strip it }
109
+ end
110
+
111
+ def strip(string)
112
+ case strip_mode
113
+ when :strict then string
114
+ when :right_only then string.rstrip
115
+ when :right_and_internal then string.rstrip.squeeze(' ')
116
+ when :left_and_right then string.strip
117
+ when :left_right_and_internal then string.strip.squeeze(' ')
118
+ else raise "Unsupported strip mode #{@strip_mode}"
119
+ end
120
+ end
121
+
122
+ def queries
123
+ @queries ||= [query] + cookie
124
+ end
125
+
126
+ def strip_mode
127
+ @request.dig(:settings, :interactive_strip_mode) || @strip_mode
88
128
  end
89
129
  end
90
130
  end
@@ -1,3 +1,3 @@
1
1
  module Mumukit
2
- VERSION = '2.44.0'
2
+ VERSION = '2.46.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.44.0
4
+ version: 2.46.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: 2023-04-13 00:00:00.000000000 Z
11
+ date: 2023-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler