mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-13 15:46:22 +00:00
* fix: clean-up bdev * feat: add workspace-centric bdev cli * fix: address review comments for 0326-bdev_cli_redesign * fix: address review feedback for PR #585 * fix: address review feedback for PR #585
29 lines
662 B
Go
29 lines
662 B
Go
package git
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestRunReturnsContextError(t *testing.T) {
|
|
home := t.TempDir()
|
|
t.Setenv("HOME", home)
|
|
config := []byte("[alias]\n\thold = !sleep 5\n")
|
|
if err := os.WriteFile(filepath.Join(home, ".gitconfig"), config, 0o644); err != nil {
|
|
t.Fatalf("WriteFile: %v", err)
|
|
}
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
|
|
defer cancel()
|
|
|
|
if _, err := Run(ctx, t.TempDir(), nil, "hold"); err == nil {
|
|
t.Fatalf("expected timeout error")
|
|
}
|
|
if ctx.Err() != context.DeadlineExceeded {
|
|
t.Fatalf("expected context deadline exceeded, got %v", ctx.Err())
|
|
}
|
|
}
|