Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/pkgsrc/pkgtools/pkglint/files/Attic/patches_test.go,v rcsdiff: /ftp/cvs/cvsroot/pkgsrc/pkgtools/pkglint/files/Attic/patches_test.go,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.9 retrieving revision 1.10 diff -u -p -r1.9 -r1.10 --- pkgsrc/pkgtools/pkglint/files/Attic/patches_test.go 2017/01/17 22:37:27 1.9 +++ pkgsrc/pkgtools/pkglint/files/Attic/patches_test.go 2017/01/29 14:27:48 1.10 @@ -24,7 +24,7 @@ func (s *Suite) Test_ChecklinesPatch__wi ChecklinesPatch(lines) - c.Check(s.Output(), equals, "") + s.CheckOutputEmpty() } func (s *Suite) Test_ChecklinesPatch__without_empty_line(c *check.C) { @@ -44,10 +44,10 @@ func (s *Suite) Test_ChecklinesPatch__wi ChecklinesPatch(lines) - c.Check(s.Output(), equals, ""+ - "AUTOFIX: ~/patch-WithoutEmptyLines:2: Inserting a line \"\" before this line.\n"+ - "AUTOFIX: ~/patch-WithoutEmptyLines:3: Inserting a line \"\" before this line.\n"+ - "AUTOFIX: ~/patch-WithoutEmptyLines: Has been auto-fixed. Please re-run pkglint.\n") + s.CheckOutputLines( + "AUTOFIX: ~/patch-WithoutEmptyLines:2: Inserting a line \"\" before this line.", + "AUTOFIX: ~/patch-WithoutEmptyLines:3: Inserting a line \"\" before this line.", + "AUTOFIX: ~/patch-WithoutEmptyLines: Has been auto-fixed. Please re-run pkglint.") fixed, err := ioutil.ReadFile(fname) c.Assert(err, check.IsNil) @@ -81,7 +81,8 @@ func (s *Suite) Test_ChecklinesPatch__wi ChecklinesPatch(lines) - c.Check(s.Output(), equals, "ERROR: patch-WithoutComment:3: Each patch must be documented.\n") + s.CheckOutputLines( + "ERROR: patch-WithoutComment:3: Each patch must be documented.") } func (s *Suite) Test_ChecklinesPatch__git_without_comment(c *check.C) { @@ -100,15 +101,17 @@ func (s *Suite) Test_ChecklinesPatch__gi ChecklinesPatch(lines) - c.Check(s.Output(), equals, "ERROR: patch-aa:5: Each patch must be documented.\n") + s.CheckOutputLines( + "ERROR: patch-aa:5: Each patch must be documented.") } func (s *Suite) Test_checklineOtherAbsolutePathname(c *check.C) { + s.Init(c) line := NewLine("patch-ag", 1, "+$install -s -c ./bin/rosegarden ${DESTDIR}$BINDIR", nil) checklineOtherAbsolutePathname(line, line.Text()) - c.Check(s.Output(), equals, "") + s.CheckOutputEmpty() } func (s *Suite) Test_ChecklinesPatch__error_code(c *check.C) { @@ -129,7 +132,7 @@ func (s *Suite) Test_ChecklinesPatch__er ChecklinesPatch(lines) - c.Check(s.Output(), equals, "") + s.CheckOutputEmpty() } func (s *Suite) Test_ChecklinesPatch__wrong_header_order(c *check.C) { @@ -151,7 +154,8 @@ func (s *Suite) Test_ChecklinesPatch__wr ChecklinesPatch(lines) - c.Check(s.Output(), equals, "WARN: patch-WrongOrder:7: Unified diff headers should be first ---, then +++.\n") + s.CheckOutputLines( + "WARN: patch-WrongOrder:7: Unified diff headers should be first ---, then +++.") } func (s *Suite) Test_ChecklinesPatch__context_diff(c *check.C) { @@ -166,12 +170,13 @@ func (s *Suite) Test_ChecklinesPatch__co ChecklinesPatch(lines) - c.Check(s.Output(), equals, ""+ - "ERROR: patch-ctx:4: Each patch must be documented.\n"+ - "WARN: patch-ctx:4: Please use unified diffs (diff -u) for patches.\n") + s.CheckOutputLines( + "ERROR: patch-ctx:4: Each patch must be documented.", + "WARN: patch-ctx:4: Please use unified diffs (diff -u) for patches.") } func (s *Suite) Test_ChecklinesPatch__no_patch(c *check.C) { + s.Init(c) lines := s.NewLines("patch-aa", "$"+"NetBSD$", "", @@ -180,10 +185,12 @@ func (s *Suite) Test_ChecklinesPatch__no ChecklinesPatch(lines) - c.Check(s.Output(), equals, "ERROR: patch-aa: Contains no patch.\n") + s.CheckOutputLines( + "ERROR: patch-aa: Contains no patch.") } func (s *Suite) Test_ChecklinesPatch__two_patched_files(c *check.C) { + s.Init(c) lines := s.NewLines("patch-aa", "$"+"NetBSD$", "", @@ -200,12 +207,13 @@ func (s *Suite) Test_ChecklinesPatch__tw ChecklinesPatch(lines) - c.Check(s.Output(), equals, ""+ - "ERROR: patch-aa:3: Each patch must be documented.\n"+ - "WARN: patch-aa: Contains patches for 2 files, should be only one.\n") + s.CheckOutputLines( + "ERROR: patch-aa:3: Each patch must be documented.", + "WARN: patch-aa: Contains patches for 2 files, should be only one.") } func (s *Suite) Test_ChecklinesPatch__documentation_that_looks_like_patch_lines(c *check.C) { + s.Init(c) lines := s.NewLines("patch-aa", "$"+"NetBSD$", "", @@ -217,10 +225,12 @@ func (s *Suite) Test_ChecklinesPatch__do ChecklinesPatch(lines) - c.Check(s.Output(), equals, "ERROR: patch-aa: Contains no patch.\n") + s.CheckOutputLines( + "ERROR: patch-aa: Contains no patch.") } func (s *Suite) Test_ChecklinesPatch__only_unified_header_but_no_content(c *check.C) { + s.Init(c) lines := s.NewLines("patch-unified", "$"+"NetBSD$", "", @@ -231,10 +241,12 @@ func (s *Suite) Test_ChecklinesPatch__on ChecklinesPatch(lines) - c.Check(s.Output(), equals, "ERROR: patch-unified:EOF: No patch hunks for \"file\".\n") + s.CheckOutputLines( + "ERROR: patch-unified:EOF: No patch hunks for \"file\".") } func (s *Suite) Test_ChecklinesPatch__only_context_header_but_no_content(c *check.C) { + s.Init(c) lines := s.NewLines("patch-context", "$"+"NetBSD$", "", @@ -247,10 +259,12 @@ func (s *Suite) Test_ChecklinesPatch__on // Context diffs are deprecated, therefore it is not worth // adding extra code for checking them thoroughly. - c.Check(s.Output(), equals, "WARN: patch-context:5: Please use unified diffs (diff -u) for patches.\n") + s.CheckOutputLines( + "WARN: patch-context:5: Please use unified diffs (diff -u) for patches.") } func (s *Suite) Test_ChecklinesPatch__Makefile_with_absolute_pathnames(c *check.C) { + s.Init(c) lines := s.NewLines("patch-unified", "$"+"NetBSD$", "", @@ -270,22 +284,23 @@ func (s *Suite) Test_ChecklinesPatch__Ma ChecklinesPatch(lines) - c.Check(s.Output(), equals, ""+ - "WARN: patch-unified:10: Found absolute pathname: /bin/cp\n"+ - "WARN: patch-unified:13: Found absolute pathname: /bin/cp\n") + s.CheckOutputLines( + "WARN: patch-unified:10: Found absolute pathname: /bin/cp", + "WARN: patch-unified:13: Found absolute pathname: /bin/cp") G.opts.WarnExtra = true ChecklinesPatch(lines) - c.Check(s.Output(), equals, ""+ - "WARN: patch-unified:8: Found absolute pathname: /bin/cp\n"+ - "WARN: patch-unified:10: Found absolute pathname: /bin/cp\n"+ - "WARN: patch-unified:13: Found absolute pathname: /bin/cp\n"+ - "WARN: patch-unified:15: Found absolute pathname: /bin/cp\n") + s.CheckOutputLines( + "WARN: patch-unified:8: Found absolute pathname: /bin/cp", + "WARN: patch-unified:10: Found absolute pathname: /bin/cp", + "WARN: patch-unified:13: Found absolute pathname: /bin/cp", + "WARN: patch-unified:15: Found absolute pathname: /bin/cp") } func (s *Suite) Test_ChecklinesPatch__no_newline_with_text_following(c *check.C) { + s.Init(c) lines := s.NewLines("patch-aa", "$"+"NetBSD$", "", @@ -302,10 +317,12 @@ func (s *Suite) Test_ChecklinesPatch__no ChecklinesPatch(lines) - c.Check(s.Output(), equals, "WARN: patch-aa:12: Empty line or end of file expected.\n") + s.CheckOutputLines( + "WARN: patch-aa:12: Empty line or end of file expected.") } func (s *Suite) Test_ChecklinesPatch__no_newline(c *check.C) { + s.Init(c) lines := s.NewLines("patch-aa", "$"+"NetBSD$", "", @@ -321,10 +338,11 @@ func (s *Suite) Test_ChecklinesPatch__no ChecklinesPatch(lines) - c.Check(s.Output(), equals, "") + s.CheckOutputEmpty() } func (s *Suite) Test_ChecklinesPatch__empty_lines_left_out_at_eof(c *check.C) { + s.Init(c) lines := s.NewLines("patch-aa", "$"+"NetBSD$", "", @@ -342,12 +360,13 @@ func (s *Suite) Test_ChecklinesPatch__em ChecklinesPatch(lines) - c.Check(s.Output(), equals, "") + s.CheckOutputEmpty() } // In some context lines, the leading space character is missing. // Since this is no problem for patch(1), pkglint also doesn't complain. func (s *Suite) Test_ChecklinesPatch__context_lines_with_tab_instead_of_space(c *check.C) { + s.Init(c) lines := s.NewLines("patch-aa", "$"+"NetBSD$", "", @@ -363,5 +382,5 @@ func (s *Suite) Test_ChecklinesPatch__co ChecklinesPatch(lines) - c.Check(s.Output(), equals, "") + s.CheckOutputEmpty() }