mumuki-haskell-runner 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a50767a14e1032fc83d6b6a224e81ab3ef6fca7d27a3569cd2cf9519fc5d2543
4
- data.tar.gz: 98f6efc72583d13f723f5e3edf10ff3de226a1a39f4872b2c44e6b99e120cd5b
3
+ metadata.gz: 7298c93467bcf1eefb0ae42a2df30276da87aef1ad5cdad377d1029f63a2e118
4
+ data.tar.gz: da7960b7ed9f7f9de9960050c7dc6cc69f87b30b138587e8b31c4e7d2425a220
5
5
  SHA512:
6
- metadata.gz: 39c1ab8b24c5c6582029c4f53b6667443183ea86e2d03dc9543dd76fdec37452bd40870c36fa1f9c4a96e1298316484dab15a66dbe605b0d46d6147c130bbd4f
7
- data.tar.gz: b6d41b31b6b085db546515daa9f6aa842b8c3e58a0d79695f180e712e2dbdcf9b21fc47eb610011c164dd58ff466d3993d984acdf84382aede00e9b8ede06c4d
6
+ metadata.gz: 87d08ef31288041ce18aa7cf427a5c176d4aa8cf6cceb29e0041505de40353389dfd02244cda60d778efc51f2ea07aedfe24c24e797cb05a005ce7528ba73ad9
7
+ data.tar.gz: fbc1194d768197e3c739986ff958b032c8e9bd88be0a31fe41a0ae1c72d8d77b243c51ca282a9482ee9a936bea0a8ef3469cef8cb51c464b4a5ce73fcd4f0797
@@ -1,4 +1,4 @@
1
- class HaskellFileHook < Mumukit::Templates::FileHook
1
+ class HaskellFileHook < Mumukit::Templates::MultiFileHook
2
2
  isolated true
3
3
 
4
4
  def cleanup_raw_result(result)
data/lib/test_hook.rb CHANGED
@@ -6,40 +6,66 @@ class HaskellTestHook < HaskellFileHook
6
6
  super(result).compact
7
7
  end
8
8
 
9
+ def has_files?(_req)
10
+ true
11
+ end
12
+
9
13
  def compile_file_content(req)
10
- <<-EOF
11
- {-# OPTIONS_GHC -fdefer-type-errors #-}
12
- import Test.Hspec
13
- import Test.Hspec.Runner (hspecWith, defaultConfig, Config (configFormatter))
14
- import Test.QuickCheck
15
- import Test.Hspec.Formatters
16
-
17
- import qualified Control.Exception as Exception
18
-
19
- import Data.List
20
-
21
- structured :: Formatter
22
- structured = silent {
23
- exampleSucceeded = \\p ->
24
- writeTerm [formatPath p, "passed", ""],
25
- exampleFailed = \\p result -> case result of
26
- (Right e) -> writeTerm [formatPath p, "failed", e]
27
- (Left e) -> writeTerm [formatPath p, "failed", show e],
28
- headerFormatter = write $ "@@@RESULTS-START@@@[",
29
- footerFormatter = write $ "null]"
30
- }
31
- where formatPath (ps, p) = intercalate " " $ (ps ++ [p])
32
- writeTerm = write.(++",").show
33
-
34
- #{req.content}
35
- #{req.extra}
36
- main :: IO ()
37
- main = hspecWith defaultConfig {configFormatter = Just structured} $ do
38
- #{req.test.lines.map {|it| ' ' + it}.join}
39
- EOF
14
+ {
15
+ 'Test.hs' => compile_test_file(req),
16
+ 'Code.hs' => compile_code_file(req)
17
+ }
40
18
  end
41
19
 
42
- def command_line(filename)
43
- "runhaskell #{filename}"
20
+ def compile_test_file(req)
21
+ <<~HASKELL
22
+ {-# OPTIONS_GHC -fdefer-type-errors #-}
23
+ import Test.Hspec
24
+ import Test.Hspec.Runner (hspecWith, defaultConfig, Config (configFormatter))
25
+ import Test.QuickCheck
26
+ import Test.Hspec.Formatters
27
+ import Code
28
+
29
+ import qualified Control.Exception as Exception
30
+
31
+ import Data.List
32
+
33
+ structured :: Formatter
34
+ structured = silent {
35
+ exampleSucceeded = \\p ->
36
+ writeTerm [formatPath p, "passed", ""],
37
+ exampleFailed = \\p result -> case result of
38
+ (Right e) -> writeTerm [formatPath p, "failed", e]
39
+ (Left e) -> writeTerm [formatPath p, "failed", show e],
40
+ headerFormatter = write $ "@@@RESULTS-START@@@[",
41
+ footerFormatter = write $ "null]"
42
+ }
43
+ where formatPath (ps, p) = intercalate " " $ (ps ++ [p])
44
+ writeTerm = write.(++",").show
45
+
46
+ main :: IO ()
47
+ main = hspecWith defaultConfig {configFormatter = Just structured} $ do
48
+ #{req.test.lines.map {|it| ' ' + it}.join}
49
+ HASKELL
50
+ end
51
+
52
+ def compile_code_file(req)
53
+ <<~HASKELL
54
+ {-# OPTIONS_GHC -fdefer-type-errors #-}
55
+ module Code where
56
+
57
+ #{req.content}
58
+ #{req.extra}
59
+ HASKELL
60
+ end
61
+
62
+ def command_line(test_file, _code_file)
63
+ ['bash', '-c', "cd #{dir_from_file_path test_file} && runhaskell #{test_file}"]
64
+ end
65
+
66
+ private
67
+
68
+ def dir_from_file_path(file_path)
69
+ file_path[/.*\//]
44
70
  end
45
71
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module HaskellVersionHook
2
- VERSION = '1.4.0'
2
+ VERSION = '1.5.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-haskell-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.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: 2019-03-12 00:00:00.000000000 Z
11
+ date: 2020-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit
@@ -129,7 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubygems_version: 3.0.3
132
+ rubyforge_project:
133
+ rubygems_version: 2.7.7
133
134
  signing_key:
134
135
  specification_version: 4
135
136
  summary: Haskell Runner for Mumuki