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 +4 -4
- data/lib/haskell_file_hook.rb +1 -1
- data/lib/test_hook.rb +58 -32
- data/lib/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7298c93467bcf1eefb0ae42a2df30276da87aef1ad5cdad377d1029f63a2e118
|
4
|
+
data.tar.gz: da7960b7ed9f7f9de9960050c7dc6cc69f87b30b138587e8b31c4e7d2425a220
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87d08ef31288041ce18aa7cf427a5c176d4aa8cf6cceb29e0041505de40353389dfd02244cda60d778efc51f2ea07aedfe24c24e797cb05a005ce7528ba73ad9
|
7
|
+
data.tar.gz: fbc1194d768197e3c739986ff958b032c8e9bd88be0a31fe41a0ae1c72d8d77b243c51ca282a9482ee9a936bea0a8ef3469cef8cb51c464b4a5ce73fcd4f0797
|
data/lib/haskell_file_hook.rb
CHANGED
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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
43
|
-
|
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
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
|
+
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:
|
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
|
-
|
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
|