internal/store: expose save via handle
All checks were successful
Test / Create distribution (push) Successful in 26s
Test / Sandbox (push) Successful in 42s
Test / Sandbox (race detector) (push) Successful in 42s
Test / Hakurei (push) Successful in 46s
Test / Hakurei (race detector) (push) Successful in 46s
Test / Hpkg (push) Successful in 42s
Test / Flake checks (push) Successful in 1m30s
All checks were successful
Test / Create distribution (push) Successful in 26s
Test / Sandbox (push) Successful in 42s
Test / Sandbox (race detector) (push) Successful in 42s
Test / Hakurei (push) Successful in 46s
Test / Hakurei (race detector) (push) Successful in 46s
Test / Hpkg (push) Successful in 42s
Test / Flake checks (push) Successful in 1m30s
The handle is otherwise inaccessible without the compat interface. This change also moves compatibility methods to separate adapter structs to avoid inadvertently using them. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -30,6 +30,9 @@ func newHandle(base *check.Absolute, identity int) *store.Handle
|
||||
//go:linkname open hakurei.app/internal/store.(*EntryHandle).open
|
||||
func open(eh *store.EntryHandle, flag int, perm os.FileMode) (*os.File, error)
|
||||
|
||||
//go:linkname save hakurei.app/internal/store.(*EntryHandle).save
|
||||
func save(eh *store.EntryHandle, state *hst.State) error
|
||||
|
||||
func TestStateEntryHandle(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -44,7 +47,7 @@ func TestStateEntryHandle(t *testing.T) {
|
||||
if err := eh.Destroy(); !reflect.DeepEqual(err, wantErr()) {
|
||||
t.Errorf("destroy: error = %v, want %v", err, wantErr())
|
||||
}
|
||||
if err := eh.Save(nil); !reflect.DeepEqual(err, wantErr()) {
|
||||
if err := save(&eh, nil); !reflect.DeepEqual(err, wantErr()) {
|
||||
t.Errorf("save: error = %v, want %v", err, wantErr())
|
||||
}
|
||||
if _, err := eh.Load(nil); !reflect.DeepEqual(err, wantErr()) {
|
||||
@@ -90,7 +93,7 @@ func TestStateEntryHandle(t *testing.T) {
|
||||
eh := store.EntryHandle{Pathname: check.MustAbs(t.TempDir()).Append("entry"),
|
||||
ID: newTemplateState().ID}
|
||||
|
||||
if err := eh.Save(newTemplateState()); err != nil {
|
||||
if err := save(&eh, newTemplateState()); err != nil {
|
||||
t.Fatalf("save: error = %v", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user