3 # Check utils.parse_changes()'s .dsc file validation
4 # Copyright (C) 2000 James Troup <james@nocrew.org>
5 # $Id: test.py,v 1.1 2001-01-28 09:06:44 troup Exp $
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 ################################################################################
25 sys.path.append(os.path.abspath('../../'));
29 ################################################################################
32 sys.stderr.write("%s\n" % (message));
35 ################################################################################
39 utils.parse_changes('1.dsc',1);
41 # Missing blank line before signature body
43 utils.parse_changes('2.dsc',1);
44 except utils.invalid_dsc_format_exc, line:
46 fail("Incorrect line number ('%s') for test #2." % (line));
48 fail("Test #2 wasn't recognised as invalid.");
50 # Missing blank line after signature header
52 utils.parse_changes('3.dsc',1);
53 except utils.invalid_dsc_format_exc, line:
55 fail("Incorrect line number ('%s') for test #3." % (line));
57 fail("Test #3 wasn't recognised as invalid.");
59 # No blank lines at all
61 utils.parse_changes('4.dsc',1);
62 except utils.invalid_dsc_format_exc, line:
64 fail("Incorrect line number ('%s') for test #4." % (line));
66 fail("Test #4 wasn't recognised as invalid.");
68 # Extra blank line before signature body
70 utils.parse_changes('5.dsc',1);
71 except utils.invalid_dsc_format_exc, line:
73 fail("Incorrect line number ('%s') for test #5." % (line));
75 fail("Test #5 wasn't recognised as invalid.");
77 # Extra blank line after signature header
79 utils.parse_changes('6.dsc',1);
80 except utils.invalid_dsc_format_exc, line:
82 fail("Incorrect line number ('%s') for test #6." % (line));
84 fail("Test #6 wasn't recognised as invalid.");
86 # Valid .dsc ; ignoring errors
87 utils.parse_changes('1.dsc', 0);
89 # Invalid .dsc ; ignoring errors
90 utils.parse_changes('2.dsc', 0);
92 ################################################################################
94 if __name__ == '__main__':