Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
systems order tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aakropotkin committed Sep 5, 2023
1 parent cdd5b1e commit cb68192
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/search.bats
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,36 @@ genParams() {
}


# ---------------------------------------------------------------------------- #

# bats test_tags=search:system, search:pname

# `systems' ordering
@test "'pkgdb search' systems order" {
run sh -c "$PKGDB search '$(
genParams '.systems+=["x86_64-darwin"]|.query.pname="hello"';
)'|jq -rs 'to_entries|map( ( .key|tostring ) + \" \" + .value.path[1] )[]'";
assert_success;
assert_output --partial '0 x86_64-linux';
assert_output --partial '1 x86_64-darwin';
refute_output --partial '2 ';
}


# bats test_tags=search:system, search:pname

# `systems' ordering, reverse order of previous
@test "'pkgdb search' systems order ( reversed )" {
run sh -c "$PKGDB search '$(
genParams '.systems=["x86_64-darwin","x86_64-linux"]|.query.pname="hello"';
)'|jq -rs 'to_entries|map( ( .key|tostring ) + \" \" + .value.path[1] )[]'";
assert_success;
assert_output --partial '0 x86_64-darwin';
assert_output --partial '1 x86_64-linux';
refute_output --partial '2 ';
}


# ---------------------------------------------------------------------------- #
#
#
Expand Down

0 comments on commit cb68192

Please sign in to comment.