guard-haskell 1.2.0 → 1.3.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 +8 -8
- data/CHANGELOG.md +14 -0
- data/README.md +7 -3
- data/lib/guard/haskell.rb +22 -9
- data/lib/guard/haskell/repl.rb +45 -37
- data/lib/guard/haskell/version.rb +1 -1
- data/spec/guard/haskell/repl_spec.rb +195 -0
- data/spec/guard/haskell_spec.rb +33 -17
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2MzMTgzOGIwYWRkNTkyYmNmYzBiNGM4YmEwMDA0Mzk2YTgxYmUzZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmQxZTYxM2NkNDgyZGUzNDFiZTc1YjdkOTMzZjg4OTk5N2MyNmZmMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2M2ZTc4ODU1NWRhNWI1MTUzOThhYjQ4NzFhNmEyZDc1NWIzMDhhYmQ0NWJi
|
10
|
+
MmNkNDAzYmQ0MmIxMDhkNWUyZTMxMjAwZTk1NjQyMmQzZGRmZmM4NTU2ZGQ3
|
11
|
+
YWU2MzgzODkyYmE1NTBjZWE0OTYzODhkYWJiMzZiMzU0MjBhMjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTc3MWI3NjcwYTllNTVmOTBmMTc0ZThiYTZjMTI1YWE5ZTM1ODIxZTA5N2U2
|
14
|
+
ZjU4MTZjMzg5M2QzMWY0ZTNiZmE3YTQ3ZTQ0NDNlOTQ1ZmQ4ZDM3Y2NmYTM2
|
15
|
+
MzVhYjlmZmU4NGZlMzUwMjJkNmViNTdlMTgwMDg0NTRlODIxZTE=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
1.3.0
|
2
|
+
=====
|
3
|
+
|
4
|
+
* Ignore user cabal package database if sandbox is found
|
5
|
+
* Catch CPP failures (previously did n't work because of the typo)
|
6
|
+
* Add `focus_on_fail` option
|
7
|
+
|
8
|
+
1.2.0
|
9
|
+
=====
|
10
|
+
|
11
|
+
* Catch GHCI runtime linker failures
|
12
|
+
* Separate runtime and compile time failures for `--rerun` to work better
|
13
|
+
* Fix ignored spec results if spec was run directly from guard repl
|
14
|
+
|
1
15
|
1.1.0
|
2
16
|
=====
|
3
17
|
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ guard-haskell
|
|
20
20
|
|
21
21
|
For explanation what `guard` is and how to use it, please refer to the [`guard manual`][0]
|
22
22
|
|
23
|
-
`guard-haskell` uses [`hspec`][1] to run specs and check
|
23
|
+
`guard-haskell` uses [`hspec`][1] to run specs and check results, so it makes some assumptions about your code style:
|
24
24
|
|
25
25
|
* `hspec` is your testing framework and
|
26
26
|
|
@@ -57,11 +57,15 @@ end
|
|
57
57
|
|
58
58
|
### `all_on_start`
|
59
59
|
|
60
|
-
Run all
|
60
|
+
Run all examples on start (default: `false`).
|
61
61
|
|
62
62
|
### `all_on_pass`
|
63
63
|
|
64
|
-
Run all
|
64
|
+
Run all examples after previously failing spec _finally_ passes (default: `false`).
|
65
|
+
|
66
|
+
### `focus_on_fail`
|
67
|
+
|
68
|
+
Rerun only failed examples until they pass (default: `true`).
|
65
69
|
|
66
70
|
### `ghci_options`
|
67
71
|
|
data/lib/guard/haskell.rb
CHANGED
@@ -23,16 +23,29 @@ module ::Guard
|
|
23
23
|
require 'guard/haskell/repl'
|
24
24
|
|
25
25
|
attr_reader :repl, :top_spec, :ghci_options, :targets, :last_run
|
26
|
-
attr_reader :all_on_start, :all_on_pass
|
26
|
+
attr_reader :all_on_start, :all_on_pass, :focus_on_fail
|
27
27
|
|
28
|
-
|
28
|
+
DEFAULT_OPTIONS = {
|
29
|
+
top_spec: "test/Spec.hs",
|
30
|
+
ghci_options: [],
|
31
|
+
all_on_start: false,
|
32
|
+
all_on_pass: false,
|
33
|
+
focus_on_fail: true,
|
34
|
+
}
|
35
|
+
|
36
|
+
def initialize(user_options = {})
|
29
37
|
super
|
30
|
-
|
31
|
-
@
|
32
|
-
|
33
|
-
|
34
|
-
@
|
35
|
-
@
|
38
|
+
|
39
|
+
@last_run = :success # try to prove it wasn't :-)
|
40
|
+
|
41
|
+
options = DEFAULT_OPTIONS.merge(user_options)
|
42
|
+
@top_spec = options[:top_spec]
|
43
|
+
@ghci_options = options[:ghci_options]
|
44
|
+
@all_on_start = options[:all_on_start]
|
45
|
+
@all_on_pass = options[:all_on_pass]
|
46
|
+
@focus_on_fail = options[:focus_on_fail]
|
47
|
+
|
48
|
+
@repl = Repl.new
|
36
49
|
end
|
37
50
|
|
38
51
|
def start
|
@@ -61,7 +74,7 @@ module ::Guard
|
|
61
74
|
end
|
62
75
|
|
63
76
|
def run pattern
|
64
|
-
if last_run == :runtime_failure
|
77
|
+
if focus_on_fail and last_run == :runtime_failure
|
65
78
|
repl.rerun
|
66
79
|
else
|
67
80
|
repl.run(pattern)
|
data/lib/guard/haskell/repl.rb
CHANGED
@@ -1,65 +1,57 @@
|
|
1
1
|
require 'open3'
|
2
2
|
|
3
3
|
class ::Guard::Haskell::Repl
|
4
|
-
attr_reader :stdin, :
|
4
|
+
attr_reader :stdin, :listener, :thread, :result
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@running = false
|
8
8
|
@result = :success
|
9
9
|
end
|
10
10
|
|
11
|
+
def self.test(str)
|
12
|
+
case str
|
13
|
+
when /\d+ examples?, 0 failures/
|
14
|
+
:success
|
15
|
+
when /\d+ examples?, \d+ failures?/
|
16
|
+
:runtime_failure
|
17
|
+
when /Failed, modules loaded:/,
|
18
|
+
/\*{3} Exception:/,
|
19
|
+
/phase `C pre-processor' failed/,
|
20
|
+
/GHCi runtime linker: fatal error:/
|
21
|
+
:compile_failure
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
11
25
|
def start ghci_options
|
12
26
|
cmd = ["ghci"]
|
13
27
|
Dir["*"].each { |d| cmd << "-i#{d}" if File.directory?(d) }
|
14
28
|
sandbox = ::Dir[".cabal-sandbox/*packages.conf.d"].first
|
15
|
-
cmd
|
29
|
+
cmd.concat(["-no-user-package-db", "-package-db=#{sandbox}"]) if sandbox
|
16
30
|
cmd.concat(ghci_options)
|
17
31
|
|
18
32
|
@stdin, stdout, @thread = ::Open3.popen2e(*cmd)
|
19
|
-
@
|
20
|
-
loop do
|
21
|
-
while (out = stdout.gets)
|
22
|
-
print out
|
23
|
-
if @running
|
24
|
-
case out
|
25
|
-
when /\d+ examples?, 0 failures/
|
26
|
-
@result = :success
|
27
|
-
@running = false
|
28
|
-
when /\d+ examples?, \d+ failures?/
|
29
|
-
@result = :runtime_failure
|
30
|
-
@running = false
|
31
|
-
when /Failed, modules loaded:/,
|
32
|
-
/\*{3} Exception:/,
|
33
|
-
/phase `C preprocessor' failed/,
|
34
|
-
/^GHCi runtime linker: fatal error:/
|
35
|
-
@result = :compile_failure
|
36
|
-
@running = false
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
33
|
+
@listener = ::Thread.new { listen(stdout, STDOUT) }
|
42
34
|
end
|
43
35
|
|
44
|
-
def init
|
45
|
-
|
36
|
+
def init(spec)
|
37
|
+
repl(":load #{spec}\n")
|
46
38
|
end
|
47
39
|
|
48
40
|
def exit
|
49
|
-
::Process::kill
|
50
|
-
::Thread.kill(
|
41
|
+
::Process::kill("TERM", thread.pid)
|
42
|
+
::Thread.kill(listener)
|
51
43
|
end
|
52
44
|
|
53
|
-
def run
|
45
|
+
def run(pattern = nil)
|
54
46
|
if pattern.nil?
|
55
|
-
|
47
|
+
repl(":reload\n:main --color\n")
|
56
48
|
else
|
57
|
-
|
49
|
+
repl(":reload\n:main --color --match #{pattern}\n")
|
58
50
|
end
|
59
51
|
end
|
60
52
|
|
61
53
|
def rerun
|
62
|
-
|
54
|
+
repl(":reload\n:main --color --rerun\n")
|
63
55
|
end
|
64
56
|
|
65
57
|
def result
|
@@ -67,8 +59,24 @@ class ::Guard::Haskell::Repl
|
|
67
59
|
@result
|
68
60
|
end
|
69
61
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
62
|
+
private
|
63
|
+
|
64
|
+
def repl(command)
|
65
|
+
@running = true
|
66
|
+
stdin.write(command)
|
67
|
+
end
|
68
|
+
|
69
|
+
def listen(in_stream, out_stream)
|
70
|
+
while (str = in_stream.gets)
|
71
|
+
out_stream.print(str)
|
72
|
+
if @running
|
73
|
+
res = self.class.test(str)
|
74
|
+
case res
|
75
|
+
when :success, :runtime_failure, :compile_failure
|
76
|
+
@result = res
|
77
|
+
@running = false
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
74
82
|
end
|
@@ -0,0 +1,195 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'guard/notifier'
|
3
|
+
|
4
|
+
describe ::Guard::Haskell::Repl do
|
5
|
+
let(:repl) do
|
6
|
+
::Guard::Haskell::Repl.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#init' do
|
10
|
+
it "calls :load on ghci instance" do
|
11
|
+
expect(repl).to receive(:repl).with(/:load/)
|
12
|
+
repl.init("Spec.hs")
|
13
|
+
end
|
14
|
+
|
15
|
+
it "loads provided spec" do
|
16
|
+
expect(repl).to receive(:repl).with(/FooBarSpec.hs/)
|
17
|
+
repl.init("FooBarSpec.hs")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#run' do
|
22
|
+
it "reloads the spec if no pattern is provided" do
|
23
|
+
expect(repl).to receive(:repl).with(/:reload/)
|
24
|
+
repl.run
|
25
|
+
end
|
26
|
+
|
27
|
+
it "reloads the spec if a pattern is provided" do
|
28
|
+
expect(repl).to receive(:repl).with(/:reload/)
|
29
|
+
repl.run("FooBar")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "provides a pattern for spec to match" do
|
33
|
+
expect(repl).to receive(:repl).with(/--match FooBar/)
|
34
|
+
repl.run("FooBar")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#rerun' do
|
39
|
+
it "reloads the spec" do
|
40
|
+
expect(repl).to receive(:repl).with(/:reload/)
|
41
|
+
repl.rerun
|
42
|
+
end
|
43
|
+
|
44
|
+
it "reruns the spec" do
|
45
|
+
expect(repl).to receive(:repl).with(/--rerun/)
|
46
|
+
repl.rerun
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#test' do
|
51
|
+
it "handles zero examples/failures" do
|
52
|
+
expect(::Guard::Haskell::Repl.test("0 examples, 0 failures")).to eq(:success)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "handles one example/zero failures" do
|
56
|
+
expect(::Guard::Haskell::Repl.test("1 example, 0 failures")).to eq(:success)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "handles multiple examples/zero failures" do
|
60
|
+
expect(::Guard::Haskell::Repl.test("37 examples, 0 failures")).to eq(:success)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "handles one example/failure" do
|
64
|
+
expect(::Guard::Haskell::Repl.test("1 example, 1 failure")).to eq(:runtime_failure)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "handles multiple examples/multiple failures" do
|
68
|
+
expect(::Guard::Haskell::Repl.test("26 examples, 2 failures")).to eq(:runtime_failure)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "handles failure to load the module" do
|
72
|
+
expect(::Guard::Haskell::Repl.test("Failed, modules loaded:")).to eq(:compile_failure)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "handles uncaught exceptions" do
|
76
|
+
expect(::Guard::Haskell::Repl.test("*** Exception: Prelude.undefined")).to eq(:compile_failure)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "handles CPP errors" do
|
80
|
+
expect(::Guard::Haskell::Repl.test("phase `C pre-processor' failed")).to eq(:compile_failure)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "handles runtime linker errors" do
|
84
|
+
expect(::Guard::Haskell::Repl.test("GHCi runtime linker: fatal error:")).to eq(:compile_failure)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe '#listen' do
|
89
|
+
context 'real world' do
|
90
|
+
it "handles typical passed run" do
|
91
|
+
in_stream = ::StringIO.open(<<-FOO)
|
92
|
+
Useful.Git
|
93
|
+
fromGraph
|
94
|
+
- creates `git init' script from empty graph
|
95
|
+
- creates git script from two-node graph
|
96
|
+
- creates git script from three-node graph
|
97
|
+
- creates git script from three-node chain graph
|
98
|
+
|
99
|
+
Finished in 0.0054 seconds
|
100
|
+
4 examples, 0 failures
|
101
|
+
FOO
|
102
|
+
out_stream = File.open("/dev/null", "w")
|
103
|
+
repl.instance_variable_set(:@running, true)
|
104
|
+
|
105
|
+
repl.send(:listen, in_stream, out_stream)
|
106
|
+
|
107
|
+
expect(repl.instance_variable_get(:@running)).to eq(false)
|
108
|
+
expect(repl.instance_variable_get(:@result)).to eq(:success)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "handles typical failed spec run" do
|
112
|
+
in_stream = ::StringIO.open(<<-FOO)
|
113
|
+
Useful.Git
|
114
|
+
fromGraph
|
115
|
+
- creates `git init' script from empty graph
|
116
|
+
- creates git script from two-node graph FAILED [1]
|
117
|
+
- creates git script from three-node graph
|
118
|
+
- creates git script from three-node chain graph
|
119
|
+
|
120
|
+
1) Useful.Git.fromGraph creates git script from two-node graph
|
121
|
+
expected: Just [InitE,OrphanE "foo" "7",CommitE "bar" ["1"] "2"]
|
122
|
+
but got: Just [InitE,OrphanE "foo" "1",CommitE "bar" ["1"] "2"]
|
123
|
+
|
124
|
+
Randomized with seed 4611685481380198536
|
125
|
+
|
126
|
+
Finished in 0.0089 seconds
|
127
|
+
4 examples, 1 failure
|
128
|
+
*** Exception: ExitFailure 1
|
129
|
+
FOO
|
130
|
+
out_stream = File.open("/dev/null", "w")
|
131
|
+
repl.instance_variable_set(:@running, true)
|
132
|
+
|
133
|
+
repl.send(:listen, in_stream, out_stream)
|
134
|
+
|
135
|
+
expect(repl.instance_variable_get(:@running)).to eq(false)
|
136
|
+
expect(repl.instance_variable_get(:@result)).to eq(:runtime_failure)
|
137
|
+
end
|
138
|
+
|
139
|
+
it "handles runtime linker error" do
|
140
|
+
in_stream = ::StringIO.open(<<-FOO)
|
141
|
+
GHCi runtime linker: fatal error: I found a duplicate definition for symbol
|
142
|
+
HUnitzm1zi2zi5zi2_TestziHUnitziBase_zdwzdcshowsPrec_slow
|
143
|
+
whilst processing object file
|
144
|
+
/home/maksenov/.cabal/lib/HUnit-1.2.5.2/ghc-7.6.2/HSHUnit-1.2.5.2.o
|
145
|
+
This could be caused by:
|
146
|
+
* Loading two different object files which export the same symbol
|
147
|
+
* Specifying the same object file twice on the GHCi command line
|
148
|
+
* An incorrect `package.conf' entry, causing some object to be
|
149
|
+
loaded twice.
|
150
|
+
GHCi cannot safely continue in this situation. Exiting now. Sorry.
|
151
|
+
FOO
|
152
|
+
out_stream = File.open("/dev/null", "w")
|
153
|
+
repl.instance_variable_set(:@running, true)
|
154
|
+
|
155
|
+
repl.send(:listen, in_stream, out_stream)
|
156
|
+
|
157
|
+
expect(repl.instance_variable_get(:@running)).to eq(false)
|
158
|
+
expect(repl.instance_variable_get(:@result)).to eq(:compile_failure)
|
159
|
+
end
|
160
|
+
|
161
|
+
it "handles hspec exceptions" do
|
162
|
+
in_stream = ::StringIO.open(<<-FOO)
|
163
|
+
*Main> Ok, modules loaded: Main, Useful.Parser, Useful.Graph, Useful.Git.
|
164
|
+
*Main>
|
165
|
+
*** Exception: Prelude.undefined
|
166
|
+
FOO
|
167
|
+
out_stream = File.open("/dev/null", "w")
|
168
|
+
repl.instance_variable_set(:@running, true)
|
169
|
+
|
170
|
+
repl.send(:listen, in_stream, out_stream)
|
171
|
+
|
172
|
+
expect(repl.instance_variable_get(:@running)).to eq(false)
|
173
|
+
expect(repl.instance_variable_get(:@result)).to eq(:compile_failure)
|
174
|
+
end
|
175
|
+
|
176
|
+
it "handles CPP exceptions" do
|
177
|
+
in_stream = ::StringIO.open(<<-FOO)
|
178
|
+
*Main>
|
179
|
+
test/Useful/GitSpec.hs:4:0:
|
180
|
+
error: invalid preprocessing directive #ifd
|
181
|
+
#ifd
|
182
|
+
^
|
183
|
+
phase `C pre-processor' failed (exitcode = 1)
|
184
|
+
FOO
|
185
|
+
out_stream = File.open("/dev/null", "w")
|
186
|
+
repl.instance_variable_set(:@running, true)
|
187
|
+
|
188
|
+
repl.send(:listen, in_stream, out_stream)
|
189
|
+
|
190
|
+
expect(repl.instance_variable_get(:@running)).to eq(false)
|
191
|
+
expect(repl.instance_variable_get(:@result)).to eq(:compile_failure)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
data/spec/guard/haskell_spec.rb
CHANGED
@@ -46,19 +46,23 @@ describe ::Guard::Haskell do
|
|
46
46
|
|
47
47
|
describe ".initialize" do
|
48
48
|
it "has :all_on_start option" do
|
49
|
-
expect(guard.instance_variable_defined?(:@all_on_start)).to
|
49
|
+
expect(guard.instance_variable_defined?(:@all_on_start)).to eq(true)
|
50
50
|
end
|
51
51
|
|
52
52
|
it "has :all_on_pass option" do
|
53
|
-
expect(guard.instance_variable_defined?(:@all_on_pass)).to
|
53
|
+
expect(guard.instance_variable_defined?(:@all_on_pass)).to eq(true)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "has :focus_on_fail option" do
|
57
|
+
expect(guard.instance_variable_defined?(:@focus_on_fail)).to eq(true)
|
54
58
|
end
|
55
59
|
|
56
60
|
it "has :ghci_options option" do
|
57
|
-
expect(guard.instance_variable_defined?(:@ghci_options)).to
|
61
|
+
expect(guard.instance_variable_defined?(:@ghci_options)).to eq(true)
|
58
62
|
end
|
59
63
|
|
60
64
|
it "has :top_spec option" do
|
61
|
-
expect(guard.instance_variable_defined?(:@top_spec)).to
|
65
|
+
expect(guard.instance_variable_defined?(:@top_spec)).to eq(true)
|
62
66
|
end
|
63
67
|
end
|
64
68
|
|
@@ -69,14 +73,14 @@ describe ::Guard::Haskell do
|
|
69
73
|
guard.start
|
70
74
|
end
|
71
75
|
|
72
|
-
it "does not run all
|
76
|
+
it "does not run all examples on start by default" do
|
73
77
|
expect(guard).not_to receive(:run_all)
|
74
78
|
expect(guard).not_to receive(:success?)
|
75
79
|
|
76
80
|
guard.start
|
77
81
|
end
|
78
82
|
|
79
|
-
it "runs all
|
83
|
+
it "runs all examples on start with :all_on_start option enabled" do
|
80
84
|
custom_guard = ::Guard::Haskell.new(all_on_start: true)
|
81
85
|
|
82
86
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:run)
|
@@ -120,7 +124,7 @@ describe ::Guard::Haskell do
|
|
120
124
|
guard.run("Foo")
|
121
125
|
end
|
122
126
|
|
123
|
-
it "runs
|
127
|
+
it "runs examples matching pattern if last run was a success" do
|
124
128
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:run).with("Foo")
|
125
129
|
guard.instance_variable_set(:@last_run, :success)
|
126
130
|
|
@@ -128,7 +132,7 @@ describe ::Guard::Haskell do
|
|
128
132
|
guard.run("Foo")
|
129
133
|
end
|
130
134
|
|
131
|
-
it "runs
|
135
|
+
it "runs examples matching pattern if last run was a compile time failure" do
|
132
136
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:run).with("Foo")
|
133
137
|
guard.instance_variable_set(:@last_run, :compile_failure)
|
134
138
|
|
@@ -136,9 +140,21 @@ describe ::Guard::Haskell do
|
|
136
140
|
guard.run("Foo")
|
137
141
|
end
|
138
142
|
|
139
|
-
it "reruns
|
143
|
+
it "reruns failing examples if last run was a runtime failure and @focus_on_fail is set" do
|
140
144
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:rerun)
|
145
|
+
expect_any_instance_of(::Guard::Haskell::Repl).not_to receive(:run).with("Foo")
|
146
|
+
guard.instance_variable_set(:@last_run, :runtime_failure)
|
147
|
+
guard.instance_variable_set(:@focus_on_fail, true)
|
148
|
+
|
149
|
+
guard.start
|
150
|
+
guard.run("Foo")
|
151
|
+
end
|
152
|
+
|
153
|
+
it "runs examples matching pattern if last run was a runtime failure but @focus_on_fail is unset" do
|
154
|
+
expect_any_instance_of(::Guard::Haskell::Repl).not_to receive(:rerun)
|
155
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:run).with("Foo")
|
141
156
|
guard.instance_variable_set(:@last_run, :runtime_failure)
|
157
|
+
guard.instance_variable_set(:@focus_on_fail, false)
|
142
158
|
|
143
159
|
guard.start
|
144
160
|
guard.run("Foo")
|
@@ -232,7 +248,7 @@ describe ::Guard::Haskell do
|
|
232
248
|
guard.success?
|
233
249
|
end
|
234
250
|
|
235
|
-
it "runs all
|
251
|
+
it "runs all examples on success after runtime failure with :all_on_pass option" do
|
236
252
|
::Guard::Haskell::Repl.any_instance.stub(:result) { :success }
|
237
253
|
custom_guard = ::Guard::Haskell.new(all_on_pass: true)
|
238
254
|
custom_guard.instance_variable_set(:@last_run, :runtime_failure)
|
@@ -243,7 +259,7 @@ describe ::Guard::Haskell do
|
|
243
259
|
custom_guard.success?
|
244
260
|
end
|
245
261
|
|
246
|
-
it "runs all
|
262
|
+
it "runs all examples on success after compile time failure with :all_on_pass option" do
|
247
263
|
::Guard::Haskell::Repl.any_instance.stub(:result) { :success }
|
248
264
|
custom_guard = ::Guard::Haskell.new(all_on_pass: true)
|
249
265
|
custom_guard.instance_variable_set(:@last_run, :compile_failure)
|
@@ -274,7 +290,7 @@ describe ::Guard::Haskell do
|
|
274
290
|
end
|
275
291
|
|
276
292
|
describe "#run_on_modifications" do
|
277
|
-
it "run
|
293
|
+
it "run examples for simple haskell files" do
|
278
294
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:run).with("Foo")
|
279
295
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
|
280
296
|
|
@@ -282,7 +298,7 @@ describe ::Guard::Haskell do
|
|
282
298
|
guard.run_on_modifications(["Foo.hs"])
|
283
299
|
end
|
284
300
|
|
285
|
-
it "run
|
301
|
+
it "run examples for simple literate haskell files" do
|
286
302
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:run).with("Foo")
|
287
303
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
|
288
304
|
|
@@ -290,7 +306,7 @@ describe ::Guard::Haskell do
|
|
290
306
|
guard.run_on_modifications(["Foo.lhs"])
|
291
307
|
end
|
292
308
|
|
293
|
-
it "run
|
309
|
+
it "run examples for *complex* haskell files" do
|
294
310
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:run).with("Bar.Baz")
|
295
311
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
|
296
312
|
|
@@ -298,7 +314,7 @@ describe ::Guard::Haskell do
|
|
298
314
|
guard.run_on_modifications(["foo/Bar/Baz.hs"])
|
299
315
|
end
|
300
316
|
|
301
|
-
it "run
|
317
|
+
it "run examples for simple haskell spec files" do
|
302
318
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:run).with("Foo")
|
303
319
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
|
304
320
|
|
@@ -306,7 +322,7 @@ describe ::Guard::Haskell do
|
|
306
322
|
guard.run_on_modifications(["FooSpec.hs"])
|
307
323
|
end
|
308
324
|
|
309
|
-
it "run
|
325
|
+
it "run examples for simple literate haskell spec files" do
|
310
326
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:run).with("Foo")
|
311
327
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
|
312
328
|
|
@@ -314,7 +330,7 @@ describe ::Guard::Haskell do
|
|
314
330
|
guard.run_on_modifications(["FooSpec.lhs"])
|
315
331
|
end
|
316
332
|
|
317
|
-
it "run
|
333
|
+
it "run examples for *complex* haskell spec files" do
|
318
334
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:run).with("Bar.Baz")
|
319
335
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
|
320
336
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-haskell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matvey Aksenov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/guard/haskell/repl.rb
|
100
100
|
- lib/guard/haskell/templates/Guardfile
|
101
101
|
- lib/guard/haskell/version.rb
|
102
|
+
- spec/guard/haskell/repl_spec.rb
|
102
103
|
- spec/guard/haskell_spec.rb
|
103
104
|
- spec/spec_helper.rb
|
104
105
|
homepage: https://github.com/supki/guard-haskell#readme
|
@@ -126,5 +127,6 @@ signing_key:
|
|
126
127
|
specification_version: 4
|
127
128
|
summary: Guard gem for Haskell
|
128
129
|
test_files:
|
130
|
+
- spec/guard/haskell/repl_spec.rb
|
129
131
|
- spec/guard/haskell_spec.rb
|
130
132
|
- spec/spec_helper.rb
|