返回 DeepSeek-Reasonix
remote_config_edit_test.go
根目录 / desktop / remote_config_edit_test.go
1 package main
2
3 import (
4 "errors"
5 "strings"
6 "testing"
7
8 "reasonix/internal/config"
9 )
10
11 func TestEditUserConfigIfChangedPropagatesLockFailureBeforeNoOp(t *testing.T) {
12 want := errors.New("timed out acquiring config lock")
13 mutated := false
14 err := editUserConfigIfChangedAtPath(
15 config.UserConfigPath(),
16 func(string) (func(), error) { return nil, want },
17 func(*config.Config) (bool, error) {
18 mutated = true
19 return false, nil
20 },
21 )
22 if !errors.Is(err, want) || !strings.Contains(err.Error(), "lock user config edits") {
23 t.Fatalf("lock failure = %v, want wrapped %v", err, want)
24 }
25 if mutated {
26 t.Fatal("no-op mutation ran without the cross-process lock")
27 }
28 }
29
29 lines GO