about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2020-08-10 08:08:57 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2020-08-16 14:24:29 +0000
commit06265d2b83d921cd41259e170642982f7fa035a4 (patch)
tree297dd25f0edae206f2a7c14a5a2fb001ad92f227
parentcdafe31e05570da92cc96159dbb02a75b48a16b0 (diff)
downloadzsh-06265d2b83d921cd41259e170642982f7fa035a4.tar.gz
zsh-06265d2b83d921cd41259e170642982f7fa035a4.tar.xz
zsh-06265d2b83d921cd41259e170642982f7fa035a4.zip
47314: is-at-least false positive (5.8.0.2 / 5.8)
Actual behaviour:

    % is-at-least 5.8.0.2 5.8 && echo yes || echo no
    yes
    % is-at-least 5.8.0.2 5.8.0.0 && echo yes || echo no
    no

Expected behaviour: Both commands should have printed "no".
-rw-r--r--ChangeLog3
-rw-r--r--Test/Z01is-at-least.ztst27
2 files changed, 30 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9c45df0c0..b756bb536 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2020-08-16  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
+	* 47314: Test/Z01is-at-least.ztst: is-at-least false positive
+	(5.8.0.2 / 5.8)
+
 	* 47313: Doc/Zsh/expn.yo: docs: Document explicitly that the
 	:P modifier returns a symlink-less path.
 
diff --git a/Test/Z01is-at-least.ztst b/Test/Z01is-at-least.ztst
new file mode 100644
index 000000000..039b3e737
--- /dev/null
+++ b/Test/Z01is-at-least.ztst
@@ -0,0 +1,27 @@
+%prep
+  autoload -Uz is-at-least
+
+%test
+
+  versions=(
+    1 1.1 1.1.1 1.2 1.2.1
+    2 2.1 2.1.1 2.2 2.2.1
+    3 3.1 3.1.1 3.2 3.2.1
+  )
+  for (( i = 1; i <= $#versions; ++i)); do
+    for (( j = i+1; j <= $#versions; ++j)); do
+      is-at-least $versions[i] $versions[j] || echo "$versions[i] ≰ $versions[j]"
+      { ! is-at-least $versions[j] $versions[i] } || echo "$versions[j] ≤ $versions[i]"
+    done
+  done
+0:is-at-least smoke test
+
+  is-at-least 5.8.0.2 5.8
+1f:regression test: Two trailing zeroes are filled in
+# TODO: When fixing this, extend the smoke test to cover this.
+
+  is-at-least 5.8.0.2 5.8.0.0
+1:regression test: Two trailing zeroes are filled in
+# TODO: Extend the smoke test to cover this.
+
+%clean