-
Notifications
You must be signed in to change notification settings - Fork 37
/
test_eget.go
51 lines (38 loc) · 1 KB
/
test_eget.go
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"fmt"
"os"
"os/exec"
)
func fileExists(path string) error {
_, err := os.Stat(path)
return err
}
func run(name string, args ...string) error {
cmd := exec.Command(name, args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}
func must(err error) {
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
func main() {
eget := os.Getenv("TEST_EGET")
must(run(eget, "--system", "linux/amd64", "jgm/pandoc"))
must(fileExists("pandoc"))
must(run(eget, "zyedidia/micro", "--tag", "nightly", "--asset", "osx"))
must(fileExists("micro"))
must(run(eget, "--asset", "nvim.appimage", "--to", "nvim", "neovim/neovim"))
must(fileExists("nvim"))
must(run(eget, "--system", "darwin/amd64", "sharkdp/fd"))
must(fileExists("fd"))
must(run(eget, "--system", "windows/amd64", "--asset", "windows-gnu", "BurntSushi/ripgrep"))
must(fileExists("rg.exe"))
must(run(eget, "-f", "eget.1", "zyedidia/eget"))
must(fileExists("eget.1"))
fmt.Println("ALL TESTS PASS")
}