feat: brain/index.go shebang; mail import is not a brain write (D14). (#12)
Commands live at bin/brain/{index,get,stats,eval,watch}.go and
bin/mail/import.go, bin/markdown/import.go, bin/postgres/query.go.
Python remains the Ladybug write worker. index_mail is a deprecation
shim that rebuilds via --with-mail.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package cmdbin
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRootHonorsKBROOT(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
t.Setenv("KB_ROOT", dir)
|
||||
if got := Root(); got != dir {
|
||||
t.Fatalf("Root() = %q, want %q", got, dir)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExecFileMissingIs127(t *testing.T) {
|
||||
t.Setenv("KB_ROOT", t.TempDir())
|
||||
if code := ExecFile("no/such-tool", nil); code != 127 {
|
||||
t.Fatalf("exit = %d, want 127", code)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExecFileRuns(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
script := filepath.Join(root, "echo.sh")
|
||||
if err := os.WriteFile(script, []byte("#!/bin/sh\nexit 3\n"), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Setenv("KB_ROOT", root)
|
||||
if code := ExecFile("echo.sh", nil); code != 3 {
|
||||
t.Fatalf("exit = %d, want 3", code)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user