From d018ef39e1abf63dfde80e07f4160d88f76f5e4f Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 14 Jun 2015 14:13:57 -0700 Subject: [PATCH] Add abbreviation tests --- tests/abbr.err | 1 + tests/abbr.in | 33 +++++++++++++++++++++++++++++++++ tests/abbr.out | 8 ++++++++ tests/abbr.status | 1 + 4 files changed, 43 insertions(+) create mode 100644 tests/abbr.err create mode 100644 tests/abbr.in create mode 100644 tests/abbr.out create mode 100644 tests/abbr.status diff --git a/tests/abbr.err b/tests/abbr.err new file mode 100644 index 000000000..904a0fd41 --- /dev/null +++ b/tests/abbr.err @@ -0,0 +1 @@ +abbr: no such abbreviation 'NOT_AN_ABBR' diff --git a/tests/abbr.in b/tests/abbr.in new file mode 100644 index 000000000..69fdfb384 --- /dev/null +++ b/tests/abbr.in @@ -0,0 +1,33 @@ +# Test basic add and list +abbr __abbr1 alpha beta gamma +abbr | grep __abbr1 + +# Erasing one that doesn't exist should do nothing +abbr --erase NOT_AN_ABBR +abbr | grep __abbr1 + +# Adding existing one should be idempotent +abbr __abbr1 alpha beta gamma +abbr | grep __abbr1 + +# Replacing +abbr __abbr1 delta +abbr | grep __abbr1 + +# -s and --show tests +abbr -s | grep __abbr1 +abbr --show | grep __abbr1 + +# Test erasing +abbr -e __abbr1 +abbr | grep __abbr1 + +# Ensure we escape special characters on output +abbr '~__abbr2' '$xyz' +abbr | grep __abbr2 +abbr -e '~__abbr2' + +# Ensure we handle leading dashes in abbreviation names properly +abbr -- '--__abbr3' 'xyz' +abbr | grep __abbr3 +abbr -e '--__abbr3' diff --git a/tests/abbr.out b/tests/abbr.out new file mode 100644 index 000000000..b0a9d5adc --- /dev/null +++ b/tests/abbr.out @@ -0,0 +1,8 @@ +abbr __abbr1 'alpha beta gamma' +abbr __abbr1 'alpha beta gamma' +abbr __abbr1 'alpha beta gamma' +abbr __abbr1 delta +abbr __abbr1 delta +abbr __abbr1 delta +abbr '~__abbr2' '$xyz' +abbr -- '--__abbr3' xyz diff --git a/tests/abbr.status b/tests/abbr.status new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/abbr.status @@ -0,0 +1 @@ +0