mumukit 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumukit/explainer.rb +23 -0
- data/lib/mumukit/metatest/checker.rb +6 -6
- data/lib/mumukit/version.rb +1 -1
- data/lib/mumukit.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8925e9f1727a1384b990a00c205f3a9c8906dc66
|
4
|
+
data.tar.gz: a293893f800ed01ba33851073a2a2574176e3a7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec200c9bf73b9e7842837b709fbbd40c9bf81a67c06364e476088b364a57f5f14e195b69f310373053faa91d2e753f4409f961ac15e50af0f841fd368bf46084
|
7
|
+
data.tar.gz: 45e77d2ce74b4771aa851e3e327f0aa1f6c121f78c93aad4538c0404361497e395496aa2ca2c057abfd2564233730beed044ea63c1629796a6ff7d95a6471013
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class Mumukit::Explainer
|
2
|
+
def explain(content, test_results)
|
3
|
+
explain_methods
|
4
|
+
.map { |selector, key| eval_explain(selector, key, content, test_results) }
|
5
|
+
.compact
|
6
|
+
.map { |explain| I18n.t(explain[:key], explain[:binding]) }
|
7
|
+
.map { |it| "* #{it}" }
|
8
|
+
.join("\n")
|
9
|
+
end
|
10
|
+
|
11
|
+
def eval_explain(selector, key, content, test_results)
|
12
|
+
send(selector, content, test_results).try do |it|
|
13
|
+
{key: key, binding: it}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def explain_methods
|
18
|
+
self.class
|
19
|
+
.instance_methods(false)
|
20
|
+
.flat_map { |it| it.to_s.captures(/explain_(.*)/).map { [it, $1] } }
|
21
|
+
.compact
|
22
|
+
end
|
23
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Mumukit::Metatest
|
2
2
|
class Checker
|
3
|
-
def check(
|
4
|
-
example[:postconditions].each { |key, arg| check_assertion key,
|
5
|
-
[example[:name], :passed, render_success_output(
|
3
|
+
def check(result, example)
|
4
|
+
example[:postconditions].each { |key, arg| check_assertion key, result, arg, example }
|
5
|
+
[example[:name], :passed, render_success_output(result)]
|
6
6
|
rescue => e
|
7
|
-
[example[:name], :failed, render_error_output(
|
7
|
+
[example[:name], :failed, render_error_output(result, e.message)]
|
8
8
|
end
|
9
9
|
|
10
10
|
def render_success_output(value)
|
@@ -15,8 +15,8 @@ module Mumukit::Metatest
|
|
15
15
|
error
|
16
16
|
end
|
17
17
|
|
18
|
-
def check_assertion(key,
|
19
|
-
send "check_#{key}",
|
18
|
+
def check_assertion(key, result, arg, example)
|
19
|
+
send "check_#{key}", result, arg
|
20
20
|
end
|
21
21
|
|
22
22
|
def fail(message)
|
data/lib/mumukit/version.rb
CHANGED
data/lib/mumukit.rb
CHANGED
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.
|
4
|
+
version: 2.5.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: 2016-08-
|
11
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -212,6 +212,7 @@ files:
|
|
212
212
|
- lib/mumukit/defaults/default_test_hook.rb
|
213
213
|
- lib/mumukit/defaults/default_validation_hook.rb
|
214
214
|
- lib/mumukit/env.rb
|
215
|
+
- lib/mumukit/explainer.rb
|
215
216
|
- lib/mumukit/hook.rb
|
216
217
|
- lib/mumukit/isolated_environment.rb
|
217
218
|
- lib/mumukit/metatest.rb
|