94
94
"""Plugin-Version: 0.6.0""" ,
95
95
"""Plugin-Version: 2.3.4""" ,
96
96
),
97
+ (
98
+ # Almost but-not-quite Manifest-Version
99
+ """anifest-Version: 0.6.0""" ,
100
+ """anifest-Version: 2.3.4""" ,
101
+ ),
102
+ ]
103
+
104
+
105
+ # A list of version-like strings that will _not_ be matched.
106
+ unmatched_strings = [
107
+ # Java JAR manifest version
108
+ "Manifest-Version: 1.0" ,
109
+ "manifest-version: 1.0" ,
97
110
]
98
111
99
112
@@ -107,3 +120,15 @@ def test_version_updates(tmp_path, original, expected):
107
120
version_file .write_text (original , encoding = "utf-8" )
108
121
update_file (version , version_file )
109
122
assert version_file .read_text (encoding = "utf-8" ) == expected
123
+
124
+ @pytest .mark .parametrize ("unmatched_line" , unmatched_strings )
125
+ def test_negative_matches (tmp_path , unmatched_line ):
126
+ """Confirm that the invalid version paths are _not_ matched."""
127
+ version = "2.3.4"
128
+
129
+ # Test the text alone (no trailing newline
130
+ version_file = tmp_path / "version.txt"
131
+ version_file .write_text (unmatched_line , encoding = "utf-8" )
132
+
133
+ with pytest .raises (ValueError ):
134
+ update_file (version , version_file )
0 commit comments