1 // Copyright (C) The Lightning Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
15 type diffSuite struct{}
17 var _ = check.Suite(&diffSuite{})
19 func (s *diffSuite) TestDiff(c *check.C) {
20 tempdir, err := ioutil.TempDir("", "")
21 c.Assert(err, check.IsNil)
22 defer os.RemoveAll(tempdir)
24 err = ioutil.WriteFile(tempdir+"/f1.fa", []byte(">f1\nactgactCacgtacgt\nactgactgacgAAcgt\n"), 0700)
25 c.Assert(err, check.IsNil)
26 err = ioutil.WriteFile(tempdir+"/f2.fa", []byte(">f2\nactgactGacgtacgt\nactgactgacgTTcgtA\n"), 0700)
27 c.Assert(err, check.IsNil)
29 var output bytes.Buffer
30 exited := (&diffFasta{}).RunCommand("diff-fasta", []string{"-sequence", "chr2", "-offset", "1000", tempdir + "/f1.fa", tempdir + "/f2.fa"}, nil, &output, os.Stderr)
31 c.Check(exited, check.Equals, 0)
32 c.Check("\n"+output.String(), check.Equals, `
33 chr2:g.1008C>G chr2 1008 C G false
34 chr2:g.1028A>T chr2 1028 A T false
35 chr2:g.1029A>T chr2 1029 A T false
36 chr2:g.1032_1033insA chr2 1033 A false