v0.3.1 1e04dbb

smoke_test.go RawHistoryFolder

1package smoke
2
3import (
4	"os"
5	"os/exec"
6	"path/filepath"
7	"testing"
8)
9
10func TestLocalRepositorySmoke(t *testing.T) {
11	tests := []struct {
12		name string
13		repo string
14	}{
15		{name: "configured local repository", repo: os.Getenv("HEXCHECK_SMOKE_REPO")},
16	}
17
18	for _, tt := range tests {
19		t.Run(tt.name, func(t *testing.T) {
20			if tt.repo == "" {
21				t.Skip("HEXCHECK_SMOKE_REPO is not set")
22			}
23			root := projectRoot(t)
24			bin := filepath.Join(t.TempDir(), "hexcheck")
25			build := exec.Command("go", "build", "-o", bin, "./cmd/hexcheck")
26			build.Dir = root
27			if output, err := build.CombinedOutput(); err != nil {
28				t.Fatalf("build hexcheck: %v\n%s", err, output)
29			}
30
31			cmd := exec.Command(bin, "-config", filepath.Join(root, "examples", "hexcheck.yaml"), "-root", tt.repo, "./...")
32			cmd.Dir = tt.repo
33			output, err := cmd.CombinedOutput()
34			if err == nil {
35				return
36			}
37			if exit, ok := err.(*exec.ExitError); ok && exit.ExitCode() == 3 && len(output) > 0 {
38				return
39			}
40			t.Fatalf("hexcheck smoke command failed: %v\n%s", err, output)
41		})
42	}
43}
44
45func projectRoot(t *testing.T) string {
46	t.Helper()
47	dir, err := os.Getwd()
48	if err != nil {
49		t.Fatal(err)
50	}
51	for {
52		if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil {
53			return dir
54		}
55		parent := filepath.Dir(dir)
56		if parent == dir {
57			t.Fatal("go.mod not found")
58		}
59		dir = parent
60	}
61}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 5

↑↓ moveenter openesc close