INNER CODE UNIT · Go

TestCompletion

xo/usql · completion_test.go:37

func TestCompletion(t *testing.T) {
	if runtime.GOOS != "linux" && runtime.GOOS != "darwin" {
		t.Skipf("recording a terminal session needs a pseudo-terminal, which %s does not provide", runtime.GOOS)
	}
	dir := t.TempDir()
	bin := filepath.Join(dir, "usql")
	build := exec.Command("go", "build", "-tags", completionTags, "-o", bin, ".")
	if out, err := build.CombinedOutput(); err != nil {
		t.Skipf("cannot build usql with %q, so completion cannot be recorded: %v\n%s", completionTags, err, out)
	}

	db := filepath.Join(dir, "completion.duckdb")
	create := exec.Command(bin, "duckdb:"+db, "-c", "create table albums (id int, title varchar)")
	if out, err := create.CombinedOutput(); err != nil {
		t.Fatalf("creating the database: %v\n%s", err, out)
	}

	tr, err := capture.Record(context.Background(), bin, capture.Session{

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…