Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
wreulicke committed Dec 11, 2024
1 parent 319df68 commit a0a7b9c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .snapshot/TestPatch_Truncate
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package main

18 changes: 18 additions & 0 deletions patch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,21 @@ func TestPatch_Remove(t *testing.T) {

s.Assert(t)
}

func TestPatch_Truncate(t *testing.T) {
t.Parallel()
p := NewPatcher("//", map[string]string{})
s := snap.New()
f, err := os.Open("testdata/truncate.go")
if err != nil {
t.Fatal(err)
}
defer f.Close()

err = p.Apply(s, f, nil)
if err != nil {
t.Error(err)
}

s.Assert(t)
}
5 changes: 5 additions & 0 deletions testdata/truncate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package main

// patchr:truncate
func main() {
}

0 comments on commit a0a7b9c

Please sign in to comment.