v0.5.0 089fa12

consumer_test.go RawHistoryFolder

1//go:build linux
2
3package wlturbo
4
5import (
6	"os"
7	"os/exec"
8	"path/filepath"
9	"testing"
10)
11
12// Run the public socketpair integration against a separate module, with no
13// imports from internal/ and no worktree replacement outside its temp go.mod.
14func TestExternalConsumer(t *testing.T) {
15	goBin, err := exec.LookPath("go")
16	if err != nil {
17		t.Skip("go executable unavailable: external module integration requires go")
18	}
19	root, err := os.Getwd()
20	if err != nil {
21		t.Fatal(err)
22	}
23	temp := t.TempDir()
24	mod := "module example.com/wlturbo-consumer\n\ngo 1.27\n\nrequire github.com/bnema/wlturbo v0.0.0\nreplace github.com/bnema/wlturbo => " + root + "\n"
25	if err := os.WriteFile(filepath.Join(temp, "go.mod"), []byte(mod), 0600); err != nil {
26		t.Fatal(err)
27	}
28	source, err := os.ReadFile(filepath.Join(root, "protocol/core/core_test.go"))
29	if err != nil {
30		t.Fatal(err)
31	}
32	// The external module has no access to the package's test helpers except
33	// the ones copied into this temporary module. Compile and exercise only
34	// the public integration scenarios, including typed key, frame and release.
35	if err := os.WriteFile(filepath.Join(temp, "consumer_test.go"), source, 0600); err != nil {
36		t.Fatal(err)
37	}
38	// Keep the extension fake server in a separate package: both fixtures
39	// independently own their socketpair helpers.
40	extension, err := os.ReadFile(filepath.Join(root, "protocol/extensions_test.go"))
41	if err != nil {
42		t.Fatal(err)
43	}
44	if err := os.Mkdir(filepath.Join(temp, "extensions"), 0700); err != nil {
45		t.Fatal(err)
46	}
47	if err := os.WriteFile(filepath.Join(temp, "extensions", "extensions_test.go"), extension, 0600); err != nil {
48		t.Fatal(err)
49	}
50	negotiation, err := os.ReadFile(filepath.Join(root, "protocol/negotiation_test.go"))
51	if err != nil {
52		t.Fatal(err)
53	}
54	if err := os.WriteFile(filepath.Join(temp, "extensions", "negotiation_test.go"), negotiation, 0600); err != nil {
55		t.Fatal(err)
56	}
57	cmd := exec.Command(goBin, "test", "-run", "TestGeneratedCoreOverSocketpair|TestBufferReleaseAndOfferChild|TestExtensionsOverSocketpair|TestAnnouncedVersionNegotiation", "./...")
58	cmd.Dir = temp
59	cmd.Env = append(os.Environ(), "GOWORK=off", "GOFLAGS=-mod=mod")
60	if output, err := cmd.CombinedOutput(); err != nil {
61		t.Fatalf("external consumer: %v\n%s", err, output)
62	}
63}

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 8

↑↓ moveenter openesc close