3 # Check utils.parse_changes()'s .dsc file validation
4 # Copyright (C) 2000, 2006 James Troup <james@nocrew.org>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 ################################################################################
24 sys.path.append(os.path.abspath('../../'))
28 ################################################################################
31 sys.stderr.write("%s\n" % (message))
34 ################################################################################
38 utils.parse_changes('1.dsc',1)
40 # Missing blank line before signature body
42 utils.parse_changes('2.dsc',1)
43 except utils.invalid_dsc_format_exc, line:
45 fail("Incorrect line number ('%s') for test #2." % (line))
47 fail("Test #2 wasn't recognised as invalid.")
49 # Missing blank line after signature header
51 utils.parse_changes('3.dsc',1)
52 except utils.invalid_dsc_format_exc, line:
54 fail("Incorrect line number ('%s') for test #3." % (line))
56 fail("Test #3 wasn't recognised as invalid.")
58 # No blank lines at all
60 utils.parse_changes('4.dsc',1)
61 except utils.invalid_dsc_format_exc, line:
63 fail("Incorrect line number ('%s') for test #4." % (line))
65 fail("Test #4 wasn't recognised as invalid.")
67 # Extra blank line before signature body
69 utils.parse_changes('5.dsc',1)
70 except utils.invalid_dsc_format_exc, line:
72 fail("Incorrect line number ('%s') for test #5." % (line))
74 fail("Test #5 wasn't recognised as invalid.")
76 # Extra blank line after signature header
78 utils.parse_changes('6.dsc',1)
79 except utils.invalid_dsc_format_exc, line:
81 fail("Incorrect line number ('%s') for test #6." % (line))
83 fail("Test #6 wasn't recognised as invalid.")
85 # Valid .dsc ; ignoring errors
86 utils.parse_changes('1.dsc', 0)
88 # Invalid .dsc ; ignoring errors
89 utils.parse_changes('2.dsc', 0)
91 ################################################################################
93 if __name__ == '__main__':