mumuki-sqlite-runner 3.3.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/test_hook.rb +10 -3
- data/lib/version_hook.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c247a76a413469d5e8c749ee216bf4d406429c560e50c69dd62ff119125d9004
|
4
|
+
data.tar.gz: b02f32da0c03682efbe31da8e906b9a21e52a0e6f99af670ef6fa4f1ec588011
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfdbc18de9b34c2b219aa222a499a91650a61b2dc213f2ac480a17be3de1d894f8b99739257b6a645d32f6f62472c63e0e4bb2b37cd3fe96ad67d608827998a5
|
7
|
+
data.tar.gz: 94addefc89c3405e2b649e1c5a49bfd38538e25290b70891c0859d8756036a4dc6efdc8f187e425c9eba28574cf6e15a1c8d90e0d13d3e14ba4ed6a39d2d759c
|
data/lib/test_hook.rb
CHANGED
@@ -54,7 +54,7 @@ class SqliteTestHook < Mumukit::Templates::FileHook
|
|
54
54
|
# Make diff between expected and student dataset result and mark each line one according comparision
|
55
55
|
def diff(expected, student)
|
56
56
|
zipped = expected.zip(student).map do |expected_i, student_i|
|
57
|
-
diff = Diffy::SplitDiff.new
|
57
|
+
diff = Diffy::SplitDiff.new expected_i << "\n", student_i << "\n"
|
58
58
|
choose_left_right(diff, expected_i, student_i).map { |e| post_process_diff e }
|
59
59
|
end
|
60
60
|
zipped.transpose.map { |dataset| post_process_datasets dataset }
|
@@ -66,12 +66,19 @@ class SqliteTestHook < Mumukit::Templates::FileHook
|
|
66
66
|
[expected, student]
|
67
67
|
end
|
68
68
|
|
69
|
+
# split lines grouping by diff mark & data content
|
70
|
+
# then append mark as dataset column & re join
|
69
71
|
def post_process_diff(data)
|
70
|
-
data.scan(/^(\s|-|\+)(.+)/)
|
71
|
-
.map { |mark, content| mark
|
72
|
+
data.scan(/^(\s|-|\+)*(.+)/)
|
73
|
+
.map { |mark, content| "#{proper_mark(mark)}#{content}" }
|
72
74
|
.join("\n")
|
73
75
|
end
|
74
76
|
|
77
|
+
def proper_mark(mark)
|
78
|
+
mark = mark.to_s
|
79
|
+
"#{mark}|" unless mark.blank?
|
80
|
+
end
|
81
|
+
|
75
82
|
# Transforms array datasets into hash with :id & :rows
|
76
83
|
def post_process_datasets(datasets)
|
77
84
|
datasets.map.with_index do |dataset, i|
|
data/lib/version_hook.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-sqlite-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Di Lorenzo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit
|