2019-08-04 06:33:45 +02:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load shared-functions
|
2020-12-21 10:50:54 +01:00
|
|
|
load '../../node_modules/bats-support/load'
|
|
|
|
load '../../node_modules/bats-assert/load'
|
2019-08-04 06:33:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
function setup() {
|
|
|
|
unset_n_env
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# labels
|
|
|
|
|
|
|
|
@test "n lsr lts" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(n lsr lts)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "$(display_remote_version lts)"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n lsr stable" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(n lsr lts)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "$(display_remote_version lts)"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n ls-remote latest" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(n ls-remote latest)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "$(display_remote_version latest)"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n list-remote current" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(n list-remote current)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "$(display_remote_version latest)"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# codenames
|
|
|
|
|
|
|
|
@test "n=1 n lsr argon" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr argon)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "4.9.1"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n=1 n lsr Argon # case" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr Argon)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "4.9.1"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# numeric versions
|
|
|
|
|
|
|
|
@test "n=1 n lsr 4" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr 4)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "4.9.1"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n=1 n lsr v4" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr v4)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "4.9.1"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n=1 n lsr 4.9" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr 4.9)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "4.9.1"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n=1 n lsr 4.9.1" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr 4.9.1)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "4.9.1"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n=1 n lsr v4.9.1" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr v4.9.1)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "4.9.1"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n lsr 6.2 # multiple matches with header" {
|
2020-12-21 10:50:54 +01:00
|
|
|
output="$(n lsr 6.2)"
|
|
|
|
assert_equal "${output}" "Listing remote... Displaying 20 matches (use --all to see all).
|
|
|
|
6.2.2
|
|
|
|
6.2.1
|
|
|
|
6.2.0"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n=1 n lsr --all 6.2 # --all, multiple matches with no header" {
|
2020-12-21 10:50:54 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n --all lsr 6.2)"
|
|
|
|
assert_equal "${output}" "6.2.2
|
|
|
|
6.2.1
|
|
|
|
6.2.0"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Checking does not match 8.11
|
|
|
|
@test "n=1 n lsr v8.1 # numeric match" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr v8.1)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "8.1.4"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Nightly
|
|
|
|
|
|
|
|
@test "n=1 n lsr nightly" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr nightly)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "$(display_remote_version nightly)"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n=1 n lsr nightly/" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr nightly/)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "$(display_remote_version nightly)"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n=1 n lsr nightly/latest" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr nightly/latest)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "$(display_remote_version nightly)"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n=1 n lsr nightly/v10.8.1-nightly201808 # partial match" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr nightly/v10.8.1-nightly201808)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "10.8.1-nightly2018081382830a809b"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Numeric match should not find v7.10.1-nightly2017050369a8053e8a
|
|
|
|
@test "n=1 n lsr nightly/7.1 # numeric match" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr nightly/7.1)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "7.1.1-nightly201611093daf11635d"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Numeric match should not find v7.10.1-nightly2017050369a8053e8a
|
|
|
|
@test "n=1 n lsr nightly/v7.1 # numeric match" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr nightly/v7.1)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "7.1.1-nightly201611093daf11635d"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "n lsr nightly/v6.10.3-nightly2017040479546c0b5a # exact" {
|
2020-12-20 04:42:27 +01:00
|
|
|
output="$(N_MAX_REMOTE_MATCHES=1 n lsr nightly/v6.10.3-nightly2017040479546c0b5a)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "6.10.3-nightly2017040479546c0b5a"
|
2019-08-04 06:33:45 +02:00
|
|
|
}
|