Skip to content
Myr

accept-nth.fish

This file

Path

test/accept-nth.fish

50 lines · 1.9 KiB

Last changed by

main: regression: --{with,accept}-nth=0 should be "ignored" (#671)Daniel Eklöfbefore adoption2a61d78

History of this file

Take it

test: accept-nth: new test suiteDaniel Eklöfbefore adoption6d2fb1e

lines 1–41why, one step back
1#!/usr/bin/fish
23set got45function test_accept_nth --argument-names input search nth_format6 set got (echo -e "$input" |7 $FUZZEL_TEST_BIN --dmenu \8 --search="$search" \9 --auto-select \10 --accept-nth="$nth_format")11end1213test_accept_nth "apple\tbanana\tcherry" "apple" "{3} - {2}: {1}"14@test "--accept-nth with valid formatters" "$got" = "cherry - banana: apple"1516test_accept_nth "apple\tbanana\tcherry" "apple" "{0} - {4}"17@test "--accept-nth with invalid column indices" "$got" = "{0} - {4}"1819test_accept_nth "apple\tbanana\tcherry" "apple" "{{1}"20@test "--accept-nth with unclosed curly bracket" "$got" = "{apple"2122test_accept_nth "apple\tbanana\tcherry" "apple" "{1a}"23@test "--accept-nth with non-numerical index" "$got" = "{1a}"2425test_accept_nth "apple\tbanana\tcherry" "apple" "{1..3}"26@test "--accept-nth with index range" "$got" = "apple banana cherry"2728test_accept_nth "apple\tbanana\tcherry" "apple" "{3..1}"29@test "--accept-nth with reversed index range" "$got" = "{3..1}"3031test_accept_nth "apple\tbanana\tcherry" "apple" "{1.3} {1...3}"32@test "--accept-nth with invalid index range" "$got" = "{1.3} {1...3}"3334test_accept_nth "apple\tbanana\tcherry" "apple" "{2..}"35@test "--accept-nth with open index range" "$got" = "banana cherry"3637test_accept_nth "apple\tbanana\tcherry" "apple" "{2.} {2...}"38@test "--accept-nth with invalid open index range" "$got" = "{2.} {2...}"3940test_accept_nth "apple\tbanana\tcherry" "apple" "{..2}"41@test "--accept-nth with invalid open index range" "$got" = "{..2}"

test: accept-nth: add test case with empty columnDaniel Eklöfbefore adoption8d3fcd1

line 42why, one step back
42

main: regression: --{with,accept}-nth=0 should be "ignored" (#671)Daniel Eklöfbefore adoption2a61d78

lines 43–50why, one step back
43test_accept_nth "first\t\tthird" first "{3}"
44@test "--accept-nth with empty column" "$got" = third4546test_accept_nth "first\tsecond" first 047@test "--accept-nth=0 " "$got" = "first second"4849test_accept_nth "first\tsecond" first ''50@test "--accept-nth= should work like 0" "$got" = "first second"