[namcap,v2,4/4] nonuniquesources: Add test for common filenames

Message ID 20190527120123.21356-2-jamespharvey20@gmail.com
State New
Headers show
Series None | expand

Commit Message

Emil Velikov via arch-projects May 27, 2019, 12:01 p.m. UTC
Signed-off-by: James P. Harvey <jamespharvey20@gmail.com>
---
 .../tests/pkgbuild/test_nonuniquesources.py   | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)

Patch

diff --git a/Namcap/tests/pkgbuild/test_nonuniquesources.py b/Namcap/tests/pkgbuild/test_nonuniquesources.py
index 1c6d75c..b647051 100644
--- a/Namcap/tests/pkgbuild/test_nonuniquesources.py
+++ b/Namcap/tests/pkgbuild/test_nonuniquesources.py
@@ -55,4 +55,40 @@  package() {
 		self.assertEqual(r.warnings, [("non-unique-source-name %s", "v1.2.3.tar.gz")])
 		self.assertEqual(r.infos, [])
 
+	def test_common_repo_non_unique(self):
+		r = self.run_on_pkg(self.pkgbuild_no_source + "source=('pkgname.tar.xz' 'LICENSE')")
+		self.assertEqual(r.errors, [])
+		self.assertEqual(r.warnings, [])
+		self.assertEqual(r.infos, [])
+
+	def test_common_external_overridden(self):
+		r = self.run_on_pkg(self.pkgbuild_no_source + "source=('pkgname.tar.xz' '${pkgname}-LICENSE::vcs+protocol://www.example.com/LICENSE')")
+		self.assertEqual(r.errors, [])
+		self.assertEqual(r.warnings, [])
+		self.assertEqual(r.infos, [])
+
+	def test_common_external_unique_part(self):
+		r = self.run_on_pkg(self.pkgbuild_no_source + "source=('pkgname.tar.xz' 'git+https://www.example.com/LICENSE-pkgname')")
+		self.assertEqual(r.errors, [])
+		self.assertEqual(r.warnings, [])
+		self.assertEqual(r.infos, [])
+
+	def test_common_external_non_unique(self):
+		r = self.run_on_pkg(self.pkgbuild_no_source + "source=('pkgname.tar.xz' 'bzr+https://www.example.com/LICENSE')")
+		self.assertEqual(r.errors, [])
+		self.assertEqual(r.warnings, [("non-unique-source-name %s", "LICENSE")])
+		self.assertEqual(r.infos, [])
+
+	def test_common_external_non_unique_ignoring_extension(self):
+		r = self.run_on_pkg(self.pkgbuild_no_source + "source=('pkgname.tar.xz' 'hg+http://www.example.com/LICENSE.txt')")
+		self.assertEqual(r.errors, [])
+		self.assertEqual(r.warnings, [("non-unique-source-name %s", "LICENSE.txt")])
+		self.assertEqual(r.infos, [])
+
+	def test_common_external_non_unique_case_insensitive(self):
+		r = self.run_on_pkg(self.pkgbuild_no_source + "source=('pkgname.tar.xz' 'svn+http://www.example.com/LiCeNsE.tXt')")
+		self.assertEqual(r.errors, [])
+		self.assertEqual(r.warnings, [("non-unique-source-name %s", "LiCeNsE.tXt")])
+		self.assertEqual(r.infos, [])
+
 # vim: set ts=4 sw=4 noet: