11 type diffSuite struct{}
13 var _ = check.Suite(&diffSuite{})
15 func (s *diffSuite) TestDiff(c *check.C) {
16 tempdir, err := ioutil.TempDir("", "")
17 c.Assert(err, check.IsNil)
18 defer os.RemoveAll(tempdir)
20 err = ioutil.WriteFile(tempdir+"/f1.fa", []byte(">f1\nactgactCacgtacgt\nactgactgacgAAcgt\n"), 0700)
21 c.Assert(err, check.IsNil)
22 err = ioutil.WriteFile(tempdir+"/f2.fa", []byte(">f2\nactgactGacgtacgt\nactgactgacgTTcgtA\n"), 0700)
23 c.Assert(err, check.IsNil)
25 var output bytes.Buffer
26 exited := (&diffFasta{}).RunCommand("diff-fasta", []string{"-sequence", "chr2", "-offset", "1000", tempdir + "/f1.fa", tempdir + "/f2.fa"}, nil, &output, os.Stderr)
27 c.Check(exited, check.Equals, 0)
28 c.Check("\n"+output.String(), check.Equals, `
29 chr2:g.1008C>G chr2 1008 C G false
30 chr2:g.1028_1029delinsTT chr2 1028 AA TT false
31 chr2:g.1032_1033insA chr2 1033 A false