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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/test_hook.rb +10 -3
  3. data/lib/version_hook.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3734b0af25cc1a8f563c7bfda8e13a7891f78421fbcda0710553bc3c5140ee8e
4
- data.tar.gz: 78b63bfb30f4f4ef26742db5e5b1f98deb80a9b89ff64d1eeddc2b0111b7ceb9
3
+ metadata.gz: c247a76a413469d5e8c749ee216bf4d406429c560e50c69dd62ff119125d9004
4
+ data.tar.gz: b02f32da0c03682efbe31da8e906b9a21e52a0e6f99af670ef6fa4f1ec588011
5
5
  SHA512:
6
- metadata.gz: eb05abd4833c0f3f7ab3a3d6125bbbfd6a1fceea140b9dead9be60a37c4030b562a2c0548614854b0afc1a3f4e2c4db9b42cca954fa8e81c48de5f6c73fa354b
7
- data.tar.gz: 30cd885678391688ff8fe2b0d3cea9a34cc51a4bf31d5bae8eee956102a7986b2f646f8db194ac4ef00bf3d883ded8418f77e4eaa4c2ca1749cdfac06fc52c82
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 student_i << "\n", expected_i << "\n"
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 << '|' << content }
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
@@ -1,3 +1,3 @@
1
1
  module SqliteVersionHook
2
- VERSION = '3.3.0'
2
+ VERSION = '3.3.1'
3
3
  end
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.0
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-03 00:00:00.000000000 Z
11
+ date: 2018-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit