File: task.yaml

package info (click to toggle)
snapd 2.72-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,412 kB
  • sloc: sh: 16,506; ansic: 16,211; python: 11,213; makefile: 1,919; exp: 190; awk: 58; xml: 22
file content (48 lines) | stat: -rw-r--r-- 1,868 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
summary: integration tests for "$TESTSTOOLS"/version-compare

details: |
    Check the version-compare tools allows comparing applications
    and snap versions.

execute: |
    # ==
    "$TESTSTOOLS"/version-compare --strict 1 -eq 1
    "$TESTSTOOLS"/version-compare --strict 1 -eq 1.0
    "$TESTSTOOLS"/version-compare --strict 1.0 -eq 1
    not "$TESTSTOOLS"/version-compare --strict 1 -eq 2

    # !=
    not "$TESTSTOOLS"/version-compare --strict 1.2 -ne  1.2
    "$TESTSTOOLS"/version-compare --strict 1 -ne 2
    "$TESTSTOOLS"/version-compare --strict 2 -ne 1

    # < and <=
    "$TESTSTOOLS"/version-compare --strict 1 -lt 2
    not "$TESTSTOOLS"/version-compare --strict 2 -lt 1
    "$TESTSTOOLS"/version-compare --strict 1 -le 2
    "$TESTSTOOLS"/version-compare --strict 2 -le 2
    not "$TESTSTOOLS"/version-compare --strict 2 -le 1

    # > and >=
    "$TESTSTOOLS"/version-compare --strict 2 -gt 1
    not "$TESTSTOOLS"/version-compare --strict 1 -gt 2
    "$TESTSTOOLS"/version-compare --strict 2 -ge 1
    "$TESTSTOOLS"/version-compare --strict 2 -ge 2
    not "$TESTSTOOLS"/version-compare --strict 1 -ge 2

    # --verbose
    "$TESTSTOOLS"/version-compare --verbose --strict 1 -eq 2 | MATCH 'delta between 1 and 2 is: -1'
    "$TESTSTOOLS"/version-compare --verbose --strict 1 -eq 2 | MATCH 'delta -1 is inconsistent with =='

    # --version
    # NOTE: older python versions print the version string to stderr
    "$TESTSTOOLS"/version-compare --version 2>&1 | MATCH 1.0

    # Strict requires all version components to be integers.
    "$TESTSTOOLS"/version-compare --strict 1.2 -eq 1.2-foo 2>&1 | MATCH 'error: version 1.2-foo is not purely numeric'
    # Such invalid comparison also returns a distinct error code.
    set +e
    "$TESTSTOOLS"/version-compare --strict 1.2 -eq 1.2-foo
    error_code=$?
    set -e
    test "$error_code" -eq 2