]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/ale/test/test_semver_utils.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / test_semver_utils.vader
diff --git a/.vim/bundle/ale/test/test_semver_utils.vader b/.vim/bundle/ale/test/test_semver_utils.vader
new file mode 100644 (file)
index 0000000..c1ed30a
--- /dev/null
@@ -0,0 +1,41 @@
+After:
+  call ale#semver#ResetVersionCache()
+
+Execute(ParseVersion should return the version from the lines of output):
+  " We should be able to parse the semver string from flake8
+  AssertEqual [3, 0, 4], ale#semver#ParseVersion([
+  \ '3.0.4 (mccabe: 0.5.2, pyflakes: 1.2.3, pycodestyle: 2.0.0) CPython 2.7.12 on Linux',
+  \ '1.2.3',
+  \])
+
+Execute(ParseVersion should return an empty list when no version can be found):
+  AssertEqual [], ale#semver#ParseVersion(['x'])
+  AssertEqual [], ale#semver#ParseVersion([])
+
+Execute(ParseVersion should tolerate missing patch numbers):
+  " This goes against the semver spec, but we handle it anyway.
+  AssertEqual [3, 4, 0], ale#semver#ParseVersion(['Version 3.4'])
+
+Execute(GTE should compare triples correctly):
+  Assert ale#semver#GTE([3, 0, 0], [2, 0, 0])
+  Assert ale#semver#GTE([3, 1, 0], [3, 1, 0])
+  Assert ale#semver#GTE([3, 2, 0], [3, 1, 0])
+  Assert ale#semver#GTE([3, 2, 2], [3, 1, 6])
+  Assert ale#semver#GTE([3, 2, 5], [3, 2, 5])
+  Assert ale#semver#GTE([3, 2, 6], [3, 2, 5])
+  Assert !ale#semver#GTE([2, 9, 1], [3, 0, 0])
+  Assert !ale#semver#GTE([3, 2, 3], [3, 3, 3])
+  Assert !ale#semver#GTE([3, 3, 2], [3, 3, 3])
+
+Execute(GTE should compare pairs correctly):
+  Assert ale#semver#GTE([3, 0], [3, 0, 0])
+  Assert ale#semver#GTE([3, 0], [3, 0])
+  Assert ale#semver#GTE([3, 1], [3, 0])
+  Assert ale#semver#GTE([3, 1], [3, 0, 0])
+  Assert ale#semver#GTE([3, 0, 1], [3, 0])
+  Assert !ale#semver#GTE([3, 0], [3, 0, 1])
+  Assert !ale#semver#GTE([3, 0], [3, 1])
+  Assert !ale#semver#GTE([2, 9, 11], [3, 0])
+
+Execute(GTE should permit the LHS to be an empty List):
+  Assert !ale#semver#GTE([], [0, 0, 0])