blob: a46bf3b2d2818ec222c289da117a4766f5a00770 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package hooks
import (
"io/ioutil"
"os"
"testing"
"golang.org/x/tools/internal/diff/difftest"
)
func TestDiff(t *testing.T) {
difftest.DiffTest(t, ComputeEdits)
}
func TestDisaster(t *testing.T) {
a := "This is a string,(\u0995) just for basic\nfunctionality"
b := "This is another string, (\u0996) to see if disaster will store stuff correctly"
fname := disaster(a, b)
buf, err := ioutil.ReadFile(fname)
if err != nil {
t.Fatal(err)
}
if string(buf) != a+"\x00"+b {
t.Error("failed to record original strings")
}
if err := os.Remove(fname); err != nil {
t.Error(err)
}
}
|