zsh/.zsh/plugins/autopairs/tests/can-skip-p.zunit
2024-12-11 15:02:36 +01:00

25 lines
743 B
Text

#!/usr/bin/env zunit
@test 'fail skip-check on blank line' {
LBUFFER='' RBUFFER='' assert_false _ap-can-skip-p '{' '}'
}
@test 'fail skip-check on wrong pair' {
LBUFFER='"' RBUFFER='"' assert_false _ap-can-skip-p '{' '}'
}
@test 'skip if next to homogeneous counter-pair' {
LBUFFER='"' RBUFFER='"' assert_true _ap-can-skip-p '"' '"'
}
@test 'skip if next to heterogeneous counter-pair' {
LBUFFER='{' RBUFFER='}' assert_true _ap-can-skip-p '{' '}'
}
@test 'do not skip if next to unbalanced, homogeneous counter-pair' {
LBUFFER='' RBUFFER='"' assert_false _ap-can-skip-p '"' '"'
}
@test 'do not skip if next to unbalanced, heterogeneous counter-pair' {
LBUFFER='' RBUFFER='}' assert_false _ap-can-skip-p '{' '}'
}