guard-haskell 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +6 -0
- data/README.md +15 -0
- data/guard-haskell.gemspec +1 -0
- data/lib/guard/haskell.rb +23 -21
- data/lib/guard/haskell/repl.rb +56 -16
- data/lib/guard/haskell/version.rb +1 -1
- data/spec/guard/haskell/repl_spec.rb +119 -22
- data/spec/guard/haskell_spec.rb +22 -38
- data/spec/run-files/hspec-exception.error +0 -1
- data/spec/run-files/runtime-linker-cannot-find-object-file.error +3 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODI3NmViYzJlOThiNjQxYjNlM2VlZWRhY2Y4MTIyODc0MThiOGRhMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODYyZTU5ZTM1YzM2OWJlNTU2ZTcxMDRmMTFjOTE2YzkxMTY5MDcyMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjVjYmNiOTIwNGM1NzZmYTBkZWYwZTRkMWE1NDY0M2Y1MWEyYzNlOTBjZDU3
|
10
|
+
NmQ3Y2IzMDhlYjBiZmQ2OTQ2OTc5YmVhOGJiZjg5MGMxNDkzMGM1MDBmYjE4
|
11
|
+
NjlkNmU3ZmUyMGYwMTQ4NzUxODVlODc0YjRkYjRiZmM1MWQ5MmI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWU4YmJkYmRkY2ZhNTZlMDI1NDI4ODllN2YyMDQ0ZGViODI2NWYwNWI3OWUz
|
14
|
+
MGJmZDkxMjAxMTRiYjE1ZmVhYTVkYzU3NmYzYTU1ZTFhOWE4ZjI1ODcyYWQ3
|
15
|
+
MGNkNzQyYTNhMjE1NWFiMjI2Mzg2OTNjN2NiNjc3NTc3YjYzMTI=
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -30,6 +30,17 @@ For explanation what `guard` is and how to use it, please refer to the [`guard m
|
|
30
30
|
When you type in `guard`, `guard-haskell` fires up an `ghci` instance which it talks to, reloading
|
31
31
|
and rerunning (parts of) "top" spec on files modifications.
|
32
32
|
|
33
|
+
## Guard::Haskell setup
|
34
|
+
|
35
|
+
For `guard-haskell` to be ready to work we need a top level spec file and a Guardfile:
|
36
|
+
|
37
|
+
```shell
|
38
|
+
mkdir --parents test
|
39
|
+
echo '{-# OPTIONS_GHC -F -pgmF hspec-discover #-}' > test/Spec.hs
|
40
|
+
guard init haskell
|
41
|
+
guard
|
42
|
+
```
|
43
|
+
|
33
44
|
## Guardfile examples
|
34
45
|
|
35
46
|
Typical haskell project:
|
@@ -75,6 +86,10 @@ Pass custom ghci options, for example, `-XCPP` directives like `-DTEST` (default
|
|
75
86
|
|
76
87
|
"Top" spec location (default: `test/Spec.hs`).
|
77
88
|
|
89
|
+
### `sandbox_glob`
|
90
|
+
|
91
|
+
A glob that matches cabal sandboxes (default: `.cabal-sandbox/*packages.conf.d`)
|
92
|
+
|
78
93
|
## Known problems
|
79
94
|
|
80
95
|
### App you test uses the GHC API
|
data/guard-haskell.gemspec
CHANGED
data/lib/guard/haskell.rb
CHANGED
@@ -22,8 +22,16 @@ module ::Guard
|
|
22
22
|
|
23
23
|
require 'guard/haskell/repl'
|
24
24
|
|
25
|
-
attr_reader :repl, :
|
26
|
-
|
25
|
+
attr_reader :repl, :targets, :last_run, :opts
|
26
|
+
|
27
|
+
Options = Struct.new(
|
28
|
+
:top_spec,
|
29
|
+
:ghci_options,
|
30
|
+
:all_on_start,
|
31
|
+
:all_on_pass,
|
32
|
+
:focus_on_fail,
|
33
|
+
:sandbox_glob,
|
34
|
+
)
|
27
35
|
|
28
36
|
DEFAULT_OPTIONS = {
|
29
37
|
top_spec: "test/Spec.hs",
|
@@ -31,30 +39,24 @@ module ::Guard
|
|
31
39
|
all_on_start: false,
|
32
40
|
all_on_pass: false,
|
33
41
|
focus_on_fail: true,
|
42
|
+
sandbox_glob: ".cabal-sandbox/*packages.conf.d",
|
34
43
|
}
|
35
44
|
|
36
45
|
def initialize(user_options = {})
|
37
46
|
super
|
38
47
|
|
39
|
-
@last_run
|
40
|
-
|
41
|
-
|
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
|
48
|
+
@last_run = :success # try to prove it wasn't :-)
|
49
|
+
@opts = Options.new(*DEFAULT_OPTIONS.merge(user_options).values)
|
50
|
+
@repl = Repl.new
|
49
51
|
end
|
50
52
|
|
51
53
|
def start
|
52
|
-
repl.start(ghci_options)
|
53
|
-
repl.init(top_spec)
|
54
|
+
repl.start(opts.ghci_options, opts.sandbox_glob)
|
55
|
+
repl.init(opts.top_spec)
|
54
56
|
|
55
57
|
@targets = ::Set.new(::Dir.glob("**/*.{hs,lhs}"))
|
56
58
|
|
57
|
-
if all_on_start
|
59
|
+
if opts.all_on_start
|
58
60
|
run_all
|
59
61
|
end
|
60
62
|
end
|
@@ -69,15 +71,15 @@ module ::Guard
|
|
69
71
|
end
|
70
72
|
|
71
73
|
def run_all
|
72
|
-
repl.
|
74
|
+
repl.reload_and_run_matching
|
73
75
|
success?
|
74
76
|
end
|
75
77
|
|
76
78
|
def run pattern
|
77
|
-
if focus_on_fail and last_run == :runtime_failure
|
78
|
-
repl.
|
79
|
+
if opts.focus_on_fail and last_run == :runtime_failure
|
80
|
+
repl.reload_and_rerun
|
79
81
|
else
|
80
|
-
repl.
|
82
|
+
repl.reload_and_run_matching(pattern)
|
81
83
|
end
|
82
84
|
success?
|
83
85
|
end
|
@@ -88,7 +90,7 @@ module ::Guard
|
|
88
90
|
[:compile_failure, :success]
|
89
91
|
@last_run = :success
|
90
92
|
Notifier.notify('Success')
|
91
|
-
if all_on_pass
|
93
|
+
if opts.all_on_pass
|
92
94
|
run_all
|
93
95
|
end
|
94
96
|
when [:success, :success]
|
@@ -110,7 +112,7 @@ module ::Guard
|
|
110
112
|
def run_on_additions paths
|
111
113
|
unless paths.all? { |path| targets.include? path }
|
112
114
|
@targets += paths
|
113
|
-
repl.init(top_spec)
|
115
|
+
repl.init(opts.top_spec)
|
114
116
|
end
|
115
117
|
end
|
116
118
|
|
data/lib/guard/haskell/repl.rb
CHANGED
@@ -10,12 +10,14 @@ class ::Guard::Haskell::Repl
|
|
10
10
|
|
11
11
|
def self.test(str)
|
12
12
|
case str
|
13
|
-
when /\d+ examples?, 0 failures
|
13
|
+
when /\d+ examples?, 0 failures/,
|
14
|
+
/Ok, modules loaded:/
|
14
15
|
:success
|
15
16
|
when /\d+ examples?, \d+ failures?/
|
16
17
|
:runtime_failure
|
17
18
|
when /Failed, modules loaded:/,
|
18
19
|
/\*{3} Exception:/,
|
20
|
+
/cannot find object file for module/,
|
19
21
|
/phase `C pre-processor' failed/,
|
20
22
|
/GHCi runtime linker: fatal error:/,
|
21
23
|
/During interactive linking, GHCi couldn't find the following symbol:/
|
@@ -23,19 +25,29 @@ class ::Guard::Haskell::Repl
|
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
26
|
-
def start
|
28
|
+
def start(ghci_options, sandbox_glob)
|
27
29
|
cmd = ["ghci"]
|
30
|
+
|
28
31
|
Dir["*"].each { |d| cmd << "-i#{d}" if File.directory?(d) }
|
29
|
-
|
30
|
-
cmd.concat(["-no-user-package-db", "-package-db=#{sandbox}"]) if sandbox
|
32
|
+
lookup_sandbox(cmd, sandbox_glob)
|
31
33
|
cmd.concat(ghci_options)
|
32
34
|
|
33
35
|
@stdin, stdout, @thread = ::Open3.popen2e(*cmd)
|
34
36
|
@listener = ::Thread.new { listen(stdout, STDOUT) }
|
35
37
|
end
|
36
38
|
|
39
|
+
def lookup_sandbox(cmd, sandbox_glob)
|
40
|
+
sandboxes = Sandbox.new(sandbox_glob)
|
41
|
+
sandboxes.with_best_sandbox(->(str) { str.scan(/\d+/).map(&:to_i) }) do |best_sandbox|
|
42
|
+
puts "Cabal sandboxes found:"
|
43
|
+
sandboxes.each { |sandbox| puts " #{sandbox}" }
|
44
|
+
puts "Cabal sandbox used:\n #{best_sandbox}"
|
45
|
+
cmd.concat(["-no-user-package-db", "-package-db=#{best_sandbox}"])
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
37
49
|
def init(spec)
|
38
|
-
|
50
|
+
run_command_and_wait_for_result(":load #{spec}\n")
|
39
51
|
end
|
40
52
|
|
41
53
|
def exit
|
@@ -43,26 +55,54 @@ class ::Guard::Haskell::Repl
|
|
43
55
|
::Thread.kill(listener)
|
44
56
|
end
|
45
57
|
|
46
|
-
def
|
47
|
-
if
|
48
|
-
|
49
|
-
|
50
|
-
|
58
|
+
def reload_and_run_matching(pattern = nil)
|
59
|
+
if run_command_and_wait_for_result(":reload\n")
|
60
|
+
if pattern.nil?
|
61
|
+
run_command_and_wait_for_result(":main --color\n")
|
62
|
+
else
|
63
|
+
run_command_and_wait_for_result(":main --color --match #{pattern}\n")
|
64
|
+
end
|
51
65
|
end
|
52
66
|
end
|
53
67
|
|
54
|
-
def
|
55
|
-
|
68
|
+
def reload_and_rerun
|
69
|
+
if run_command_and_wait_for_result(":reload\n")
|
70
|
+
run_command_and_wait_for_result(":main --color --rerun\n")
|
71
|
+
end
|
56
72
|
end
|
57
73
|
|
58
|
-
|
59
|
-
|
60
|
-
|
74
|
+
class Sandbox
|
75
|
+
attr_reader :sandboxes
|
76
|
+
|
77
|
+
include ::Enumerable
|
78
|
+
|
79
|
+
def initialize(glob)
|
80
|
+
@sandboxes = ::Dir[glob]
|
81
|
+
end
|
82
|
+
|
83
|
+
def each(&block)
|
84
|
+
sandboxes.each(&block)
|
85
|
+
end
|
86
|
+
|
87
|
+
def with_best_sandbox(ordering)
|
88
|
+
best = sandboxes.max_by(&ordering)
|
89
|
+
yield best if best
|
90
|
+
best
|
91
|
+
end
|
61
92
|
end
|
62
93
|
|
63
94
|
private
|
95
|
+
def run_command_and_wait_for_result(command)
|
96
|
+
talk_to_repl(command)
|
97
|
+
wait_for_result == :success
|
98
|
+
end
|
99
|
+
|
100
|
+
def wait_for_result
|
101
|
+
while @running do sleep(0.01) end
|
102
|
+
@result
|
103
|
+
end
|
64
104
|
|
65
|
-
def
|
105
|
+
def talk_to_repl(command)
|
66
106
|
@running = true
|
67
107
|
stdin.write(command)
|
68
108
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'fakefs/spec_helpers'
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'guard/notifier'
|
3
4
|
|
@@ -11,42 +12,53 @@ describe ::Guard::Haskell::Repl do
|
|
11
12
|
|
12
13
|
describe '#init' do
|
13
14
|
it "calls :load on ghci instance" do
|
14
|
-
expect(repl).to receive(:
|
15
|
+
expect(repl).to receive(:run_command_and_wait_for_result).with(/:load/)
|
15
16
|
repl.init("Spec.hs")
|
16
17
|
end
|
17
18
|
|
18
19
|
it "loads provided spec" do
|
19
|
-
expect(repl).to receive(:
|
20
|
+
expect(repl).to receive(:run_command_and_wait_for_result).with(/FooBarSpec.hs/)
|
20
21
|
repl.init("FooBarSpec.hs")
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
repl.run
|
25
|
+
context "running spec" do
|
26
|
+
before(:each) do
|
27
|
+
repl.stub(:run_command_and_wait_for_result) { |_| true }
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
describe '#reload_and_run_matching' do
|
31
|
+
it "reloads the spec if no pattern is provided" do
|
32
|
+
expect(repl).to receive(:run_command_and_wait_for_result).with(/:reload/)
|
33
|
+
repl.reload_and_run_matching
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
it "reloads the spec if a pattern is provided" do
|
37
|
+
expect(repl).to receive(:run_command_and_wait_for_result).with(/:reload/)
|
38
|
+
repl.reload_and_run_matching
|
39
|
+
end
|
40
|
+
|
41
|
+
it "provides a pattern for spec to match" do
|
42
|
+
expect(repl).to receive(:run_command_and_wait_for_result).with(/--match FooBar/)
|
43
|
+
repl.reload_and_run_matching("FooBar")
|
44
|
+
end
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
46
|
+
it "provides no pattern for spec to match if an argument is nil" do
|
47
|
+
expect(repl).not_to receive(:run_command_and_wait_for_result).with(/--match FooBar/)
|
48
|
+
repl.reload_and_run_matching(nil)
|
49
|
+
end
|
45
50
|
end
|
46
51
|
|
47
|
-
|
48
|
-
|
49
|
-
|
52
|
+
describe '#reload_and_rerun' do
|
53
|
+
it "reloads the spec" do
|
54
|
+
expect(repl).to receive(:run_command_and_wait_for_result).with(/:reload/)
|
55
|
+
repl.reload_and_rerun
|
56
|
+
end
|
57
|
+
|
58
|
+
it "reruns the spec" do
|
59
|
+
expect(repl).to receive(:run_command_and_wait_for_result).with(/--rerun/)
|
60
|
+
repl.reload_and_rerun
|
61
|
+
end
|
50
62
|
end
|
51
63
|
end
|
52
64
|
|
@@ -131,6 +143,17 @@ describe ::Guard::Haskell::Repl do
|
|
131
143
|
expect(repl.instance_variable_get(:@result)).to eq(:compile_failure)
|
132
144
|
end
|
133
145
|
|
146
|
+
# This one's even trickier to reproduce than the previous one
|
147
|
+
it 'handles "cannot find object file" runtime linker error' do
|
148
|
+
in_stream = ::File.open(run_file["runtime-linker-cannot-find-object-file.error"])
|
149
|
+
repl.instance_variable_set(:@running, true)
|
150
|
+
|
151
|
+
repl.send(:listen, in_stream, dev_null)
|
152
|
+
|
153
|
+
expect(repl.instance_variable_get(:@running)).to eq(false)
|
154
|
+
expect(repl.instance_variable_get(:@result)).to eq(:compile_failure)
|
155
|
+
end
|
156
|
+
|
134
157
|
it "handles hspec exceptions" do
|
135
158
|
in_stream = ::File.open(run_file["hspec-exception.error"])
|
136
159
|
repl.instance_variable_set(:@running, true)
|
@@ -152,4 +175,78 @@ describe ::Guard::Haskell::Repl do
|
|
152
175
|
end
|
153
176
|
end
|
154
177
|
end
|
178
|
+
|
179
|
+
describe "#lookup_sandbox" do
|
180
|
+
include FakeFS::SpecHelpers
|
181
|
+
|
182
|
+
before(:each) { ::IO.any_instance.stub(:puts) }
|
183
|
+
|
184
|
+
it "does not find anything if there are no sandboxes" do
|
185
|
+
expect_any_instance_of(::IO).not_to receive(:puts)
|
186
|
+
expect(repl.lookup_sandbox([], "*packages.conf.d")).to be_nil
|
187
|
+
end
|
188
|
+
|
189
|
+
it "finds a sandbox" do
|
190
|
+
::FileUtils.mkdir_p(["ghc-7.6.3-packages.conf.d"])
|
191
|
+
expect_any_instance_of(::IO).to receive(:puts).with("Cabal sandboxes found:")
|
192
|
+
expect(repl.lookup_sandbox([], "*packages.conf.d")).to eq("/ghc-7.6.3-packages.conf.d")
|
193
|
+
end
|
194
|
+
|
195
|
+
it "finds a sandbox with the default settings" do
|
196
|
+
::FileUtils.mkdir_p([".cabal-sandbox/foo-bar-ghc-7.6.3-packages.conf.d"])
|
197
|
+
expect_any_instance_of(::IO).to receive(:puts).with("Cabal sandboxes found:")
|
198
|
+
expect(repl.lookup_sandbox([], ::Guard::Haskell::DEFAULT_OPTIONS[:sandbox_glob])).to eq("/.cabal-sandbox/foo-bar-ghc-7.6.3-packages.conf.d")
|
199
|
+
end
|
200
|
+
|
201
|
+
it "compares sandboxes cleverly" do
|
202
|
+
::FileUtils.mkdir_p(
|
203
|
+
[ "ghc-1.0-packages.conf.d",
|
204
|
+
"ghc-1.1-packages.conf.d",
|
205
|
+
"ghc-1.2-packages.conf.d",
|
206
|
+
"ghc-1.10-packages.conf.d",
|
207
|
+
])
|
208
|
+
expect(repl.lookup_sandbox([], "*packages.conf.d")).to eq("/ghc-1.10-packages.conf.d")
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
describe ::Guard::Haskell::Repl::Sandbox do
|
214
|
+
::Sandbox = ::Guard::Haskell::Repl::Sandbox
|
215
|
+
include FakeFS::SpecHelpers
|
216
|
+
|
217
|
+
let(:id) { ->(x) { x } }
|
218
|
+
let(:reversed) { ->(str) { str.reverse } }
|
219
|
+
|
220
|
+
before(:each) { ::IO.any_instance.stub(:puts) }
|
221
|
+
|
222
|
+
it "has an empty list of sandboxes if no sandboxes are found" do
|
223
|
+
expect(::Sandbox.new("*").sandboxes).to eq([])
|
224
|
+
end
|
225
|
+
|
226
|
+
it "has a singleton list of sandboxes if one sandbox is found" do
|
227
|
+
::FileUtils.touch(["foo", "bar", "baz"])
|
228
|
+
expect(::Sandbox.new("foo").sandboxes).to eq(["/foo"])
|
229
|
+
end
|
230
|
+
|
231
|
+
it "has a list of sandboxes if more than one sandbox is found" do
|
232
|
+
::FileUtils.touch(["foo", "bar", "baz"])
|
233
|
+
expect(::Sandbox.new("ba*").sandboxes).to eq(["/bar", "/baz"])
|
234
|
+
end
|
235
|
+
|
236
|
+
it "has a nil for the best sandbox of an empty list of sandboxes" do
|
237
|
+
expect_any_instance_of(::IO).not_to receive(:puts)
|
238
|
+
expect(::Sandbox.new("*").with_best_sandbox(id) { |s| puts s }).to be_nil
|
239
|
+
end
|
240
|
+
|
241
|
+
it "chooses a \"maximum\" for the best sandbox" do
|
242
|
+
::FileUtils.touch(["foo", "bar", "baz"])
|
243
|
+
expect_any_instance_of(::IO).to receive(:puts).with("/foo")
|
244
|
+
expect(::Sandbox.new("*").with_best_sandbox(id) { |s| puts s }).to eq("/foo")
|
245
|
+
end
|
246
|
+
|
247
|
+
it "chooses a \"maximum\" of the complex ordering for the best sandbox" do
|
248
|
+
::FileUtils.touch(["foo", "bar", "baz", "zap"])
|
249
|
+
expect_any_instance_of(::IO).to receive(:puts).with("/baz")
|
250
|
+
expect(::Sandbox.new("*").with_best_sandbox(reversed) { |s| puts s }).to eq("/baz")
|
251
|
+
end
|
155
252
|
end
|
data/spec/guard/haskell_spec.rb
CHANGED
@@ -34,9 +34,7 @@ describe "monkey patching" do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe ::Guard::Haskell do
|
37
|
-
let(:guard)
|
38
|
-
::Guard::Haskell.new
|
39
|
-
end
|
37
|
+
let(:guard) { ::Guard::Haskell.new }
|
40
38
|
|
41
39
|
before :each do
|
42
40
|
::Guard.stub(:add_group)
|
@@ -45,24 +43,10 @@ describe ::Guard::Haskell do
|
|
45
43
|
end
|
46
44
|
|
47
45
|
describe ".initialize" do
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
it "has :all_on_pass option" do
|
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)
|
58
|
-
end
|
59
|
-
|
60
|
-
it "has :ghci_options option" do
|
61
|
-
expect(guard.instance_variable_defined?(:@ghci_options)).to eq(true)
|
62
|
-
end
|
63
|
-
|
64
|
-
it "has :top_spec option" do
|
65
|
-
expect(guard.instance_variable_defined?(:@top_spec)).to eq(true)
|
46
|
+
::Guard::Haskell::DEFAULT_OPTIONS.each do |key, value|
|
47
|
+
it "has :#{key} option" do
|
48
|
+
expect(::Guard::Haskell.new.opts.send(key)).to eq(value)
|
49
|
+
end
|
66
50
|
end
|
67
51
|
end
|
68
52
|
|
@@ -83,7 +67,7 @@ describe ::Guard::Haskell do
|
|
83
67
|
it "runs all examples on start with :all_on_start option enabled" do
|
84
68
|
custom_guard = ::Guard::Haskell.new(all_on_start: true)
|
85
69
|
|
86
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
70
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching).with(no_args)
|
87
71
|
expect(custom_guard).to receive(:success?)
|
88
72
|
|
89
73
|
custom_guard.start
|
@@ -116,7 +100,7 @@ describe ::Guard::Haskell do
|
|
116
100
|
|
117
101
|
describe "#run" do
|
118
102
|
it "checks success after run" do
|
119
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
103
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching).with("Foo")
|
120
104
|
expect(guard).to receive(:success?)
|
121
105
|
guard.instance_variable_set(:@last_run, :success)
|
122
106
|
|
@@ -125,7 +109,7 @@ describe ::Guard::Haskell do
|
|
125
109
|
end
|
126
110
|
|
127
111
|
it "runs examples matching pattern if last run was a success" do
|
128
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
112
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching).with("Foo")
|
129
113
|
guard.instance_variable_set(:@last_run, :success)
|
130
114
|
|
131
115
|
guard.start
|
@@ -133,7 +117,7 @@ describe ::Guard::Haskell do
|
|
133
117
|
end
|
134
118
|
|
135
119
|
it "runs examples matching pattern if last run was a compile time failure" do
|
136
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
120
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching).with("Foo")
|
137
121
|
guard.instance_variable_set(:@last_run, :compile_failure)
|
138
122
|
|
139
123
|
guard.start
|
@@ -141,20 +125,20 @@ describe ::Guard::Haskell do
|
|
141
125
|
end
|
142
126
|
|
143
127
|
it "reruns failing examples if last run was a runtime failure and @focus_on_fail is set" do
|
144
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
145
|
-
expect_any_instance_of(::Guard::Haskell::Repl).not_to receive(:
|
128
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_rerun)
|
129
|
+
expect_any_instance_of(::Guard::Haskell::Repl).not_to receive(:reload_and_run_matching).with("Foo")
|
146
130
|
guard.instance_variable_set(:@last_run, :runtime_failure)
|
147
|
-
guard.
|
131
|
+
guard.opts.focus_on_fail = true
|
148
132
|
|
149
133
|
guard.start
|
150
134
|
guard.run("Foo")
|
151
135
|
end
|
152
136
|
|
153
137
|
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(:
|
155
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
138
|
+
expect_any_instance_of(::Guard::Haskell::Repl).not_to receive(:reload_and_rerun)
|
139
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching).with("Foo")
|
156
140
|
guard.instance_variable_set(:@last_run, :runtime_failure)
|
157
|
-
guard.
|
141
|
+
guard.opts.focus_on_fail = false
|
158
142
|
|
159
143
|
guard.start
|
160
144
|
guard.run("Foo")
|
@@ -163,7 +147,7 @@ describe ::Guard::Haskell do
|
|
163
147
|
|
164
148
|
describe "#run_all" do
|
165
149
|
it "checks success after run" do
|
166
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
150
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching)
|
167
151
|
expect(guard).to receive(:success?)
|
168
152
|
guard.instance_variable_set(:@last_run, :success)
|
169
153
|
|
@@ -291,7 +275,7 @@ describe ::Guard::Haskell do
|
|
291
275
|
|
292
276
|
describe "#run_on_modifications" do
|
293
277
|
it "run examples for simple haskell files" do
|
294
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
278
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching).with("Foo")
|
295
279
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
|
296
280
|
|
297
281
|
guard.start
|
@@ -299,7 +283,7 @@ describe ::Guard::Haskell do
|
|
299
283
|
end
|
300
284
|
|
301
285
|
it "run examples for simple literate haskell files" do
|
302
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
286
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching).with("Foo")
|
303
287
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
|
304
288
|
|
305
289
|
guard.start
|
@@ -307,7 +291,7 @@ describe ::Guard::Haskell do
|
|
307
291
|
end
|
308
292
|
|
309
293
|
it "run examples for *complex* haskell files" do
|
310
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
294
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching).with("Bar.Baz")
|
311
295
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
|
312
296
|
|
313
297
|
guard.start
|
@@ -315,7 +299,7 @@ describe ::Guard::Haskell do
|
|
315
299
|
end
|
316
300
|
|
317
301
|
it "run examples for simple haskell spec files" do
|
318
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
302
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching).with("Foo")
|
319
303
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
|
320
304
|
|
321
305
|
guard.start
|
@@ -323,7 +307,7 @@ describe ::Guard::Haskell do
|
|
323
307
|
end
|
324
308
|
|
325
309
|
it "run examples for simple literate haskell spec files" do
|
326
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
310
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching).with("Foo")
|
327
311
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
|
328
312
|
|
329
313
|
guard.start
|
@@ -331,7 +315,7 @@ describe ::Guard::Haskell do
|
|
331
315
|
end
|
332
316
|
|
333
317
|
it "run examples for *complex* haskell spec files" do
|
334
|
-
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:
|
318
|
+
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching).with("Bar.Baz")
|
335
319
|
expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
|
336
320
|
|
337
321
|
guard.start
|
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.5.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: 2014-
|
11
|
+
date: 2014-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: fakefs
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: Guard::Haskell automatically runs your specs
|
84
98
|
email: matvey.aksenov@gmail.com
|
85
99
|
executables: []
|
@@ -103,6 +117,7 @@ files:
|
|
103
117
|
- spec/guard/haskell_spec.rb
|
104
118
|
- spec/run-files/cpp-exception.error
|
105
119
|
- spec/run-files/hspec-exception.error
|
120
|
+
- spec/run-files/runtime-linker-cannot-find-object-file.error
|
106
121
|
- spec/run-files/runtime-linker-couldn't-find-symbol.error
|
107
122
|
- spec/run-files/runtime-linker-duplicate-definition-for-symbol.error
|
108
123
|
- spec/run-files/spec-failure.error
|
@@ -137,6 +152,7 @@ test_files:
|
|
137
152
|
- spec/guard/haskell_spec.rb
|
138
153
|
- spec/run-files/cpp-exception.error
|
139
154
|
- spec/run-files/hspec-exception.error
|
155
|
+
- spec/run-files/runtime-linker-cannot-find-object-file.error
|
140
156
|
- spec/run-files/runtime-linker-couldn't-find-symbol.error
|
141
157
|
- spec/run-files/runtime-linker-duplicate-definition-for-symbol.error
|
142
158
|
- spec/run-files/spec-failure.error
|