-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Rakefile
37 lines (32 loc) · 909 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true
require "open3"
require "test/unit/assertions"
task test: ["test:bash", "test:fish", "test:zsh"]
namespace :test do
include Test::Unit::Assertions
[:bash, :zsh].each do |sh|
task sh do
puts "Testing with #{sh}"
command = "eval \"$(brew command-not-found-init)\"; when"
# -e: exit on first error
# -x: trace
# -c: execute the command
output, status = Open3.capture2e(sh.to_s, "-ex", "-c", command)
puts
puts output
puts
assert_equal 127, status.exitstatus
assert_match(/brew install when/, output)
end
end
task :fish do
puts "Testing with fish"
command = ". (brew command-not-found-init); when"
output, status = Open3.capture2e("fish", "-c", command)
puts
puts output
puts
assert_equal 127, status.exitstatus
assert_match(/brew install when/, output)
end
end