Add comprehensive tests for 3-way merge functionality
- Added merge_test.go with 797 lines of test coverage - Tests for field merging, dependency merging, timestamp handling - Tests for deletion detection and conflict generation - Integration tests for merge driver auto-config in bd init - Test helpers for git repository setup Closes bd-kazt All tests pass: go test ./internal/merge/... -v Amp-Thread-ID: https://ampcode.com/threads/T-f0fe7c4c-13e7-486b-b073-fc64b81eeb4b Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -3,7 +3,9 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/steveyegge/beads/internal/storage/sqlite"
|
||||
@@ -66,3 +68,21 @@ func openExistingTestDB(t *testing.T, dbPath string) (*sqlite.SQLiteStorage, err
|
||||
t.Helper()
|
||||
return sqlite.New(dbPath)
|
||||
}
|
||||
|
||||
// runCommandInDir runs a command in the specified directory
|
||||
func runCommandInDir(dir string, name string, args ...string) error {
|
||||
cmd := exec.Command(name, args...)
|
||||
cmd.Dir = dir
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
// runCommandInDirWithOutput runs a command in the specified directory and returns its output
|
||||
func runCommandInDirWithOutput(dir string, name string, args ...string) (string, error) {
|
||||
cmd := exec.Command(name, args...)
|
||||
cmd.Dir = dir
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.TrimSpace(string(output)), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user