aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy
diff options
context:
space:
mode:
authorMaciej Skrzypkowski <m.skrzypkows@samsung.com>2016-04-25 08:32:52 +0200
committerMaciej Skrzypkowski <m.skrzypkows@samsung.com>2016-04-25 08:32:52 +0200
commitf090425c242f8d2917c55368ae7cd9cee79c9b6d (patch)
treed8fe22d5846e27d41d7babcaec859a31aa0da5f5 /python/tidy
parent78041737def89de90cba20ea29afe4e107008117 (diff)
downloadservo-f090425c242f8d2917c55368ae7cd9cee79c9b6d.tar.gz
servo-f090425c242f8d2917c55368ae7cd9cee79c9b6d.zip
Test for tidy.check_lock function #9152
Diffstat (limited to 'python/tidy')
-rw-r--r--python/tidy/servo_tidy_tests/duplicated_package.lock21
-rw-r--r--python/tidy/servo_tidy_tests/test_tidy.py12
2 files changed, 33 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy_tests/duplicated_package.lock b/python/tidy/servo_tidy_tests/duplicated_package.lock
new file mode 100644
index 00000000000..77777fdd82c
--- /dev/null
+++ b/python/tidy/servo_tidy_tests/duplicated_package.lock
@@ -0,0 +1,21 @@
+[root]
+name = "servo"
+version = "0.0.1"
+
+[[package]]
+name = "test"
+version = "0.4.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "test"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "test2"
+version = "0.1.0"
+source = "git+https://github.com/"
+dependencies = [
+ "test 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
+]
diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py
index e07f0d1bb55..65eb9bc7a95 100644
--- a/python/tidy/servo_tidy_tests/test_tidy.py
+++ b/python/tidy/servo_tidy_tests/test_tidy.py
@@ -96,6 +96,18 @@ class CheckTidiness(unittest.TestCase):
self.assertEqual('vi modeline present', errors.next()[2])
self.assertEqual('emacs file variables present', errors.next()[2])
self.assertEqual('emacs file variables present', errors.next()[2])
+ self.assertNoMoreErrors(errors)
+
+ def test_lock(self):
+ errors = tidy.collect_errors_for_files(iterFile('duplicated_package.lock'), [tidy.check_lock], [])
+ msg = """duplicate versions for package "test"
+\t\033[93mfound dependency on version 0.4.9\033[0m
+\t\033[91mbut highest version is 0.5.1\033[0m
+\t\033[93mtry upgrading with\033[0m \033[96m./mach cargo-update -p test:0.4.9\033[0m
+\tThe following packages depend on version 0.4.9:
+\t\ttest2"""
+ self.assertEqual(msg, errors.next()[2])
+ self.assertNoMoreErrors(errors)
def do_tests():