Skip to content

Commit

Permalink
Merge pull request #682 from rolandwalker/rm-var-sel-workaround
Browse files Browse the repository at this point in the history
Remove variation selector workaround
  • Loading branch information
jonas authored Jul 26, 2017
2 parents bbe0284 + 76b0934 commit 7e9afc7
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 28 deletions.
10 changes: 1 addition & 9 deletions src/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,7 @@ unicode_width(unsigned long c, int tab_size)
{ 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 },
{ 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F },
{ 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B },
/*
* BUG: the last range in the next line should be { 0xFE00, 0xFE0F }
* inclusive of 0xFE0F ("VARIATION SELECTOR-16"), but that causes
* platform-specific failures in test/main/emoji-test :
* - test fails in Travis environment, both gcc/clang
* - test fails on Ubuntu 16.04 x86_64, gcc
* - test passes on OS X 10.11.6, both gcc/clang
*/
{ 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0E },
{ 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F },
{ 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB },
{ 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F },
{ 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 },
Expand Down
48 changes: 41 additions & 7 deletions test/main/emoji-test
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ tigrc <<EOF
set vertical-split = no
EOF

steps '
:save-display emojis.screen
'

test_setup_work_dir()
{
git_commit -m "🚑 Fix bug"
Expand All @@ -25,16 +21,54 @@ test_setup_work_dir()
}

git_init
test_tig

assert_equals 'emojis.screen' <<EOF
test_case emoji-commit-titles-col-40 \
--subshell='export COLUMNS=40' \
<<EOF
2009-04-06 01:44 Committer o [master] 🌏💧
2009-03-28 13:22 Committer o 💄 Polish th
2009-03-20 01:00 Committer o 📚 Document
2009-03-11 12:38 Committer o 🎨 Reformat
2009-03-03 00:15 Committer o ✨ Add new f
2009-02-22 11:53 Committer o 🐧 Fix Linux
2009-02-13 23:31 Committer I 🚑 Fix bug
[main] 50a10e108b44c34548b9ba9e31841100%
EOF

# platform-specific failures:
# - fails in Travis environment, both gcc/clang
# - fails on Ubuntu 16.04 x86_64, gcc
# - passes on OS X 10.11.6, both gcc/clang
test_case emoji-commit-titles-col-unset \
--subshell='export COLUMNS=' \
--todo="Can't unset COLUMNS on Linux for line including VARIATION SELECTOR-16" \
<<EOF
2009-04-06 01:44 Committer o [master] 🌏💧✋🕋🗡🚀🏜☀️🌡🌶💯🚱⏳🌅🌑😡💉😱😈💀💥🌛🌙🐭💥🚶🏻〰🐛️⌛️👳🙏💥😴🛌😳💥🐛
2009-03-28 13:22 Committer o 💄 Polish the UI
2009-03-20 01:00 Committer o 📚 Document new feature
2009-03-11 12:38 Committer o 🎨 Reformat the code
2009-03-03 00:15 Committer o ✨ Add new feature
2009-02-22 11:53 Committer o 🐧 Fix Linux issue
2009-02-13 23:31 Committer I 🚑 Fix bug
[main] 50a10e108b44c34548b9ba9e318416b3027a0627 - commit 1 of 7 100%
EOF

# fails on both Linux and OS X
test_case emoji-commit-titles-col-300 \
--subshell='export COLUMNS=300' \
--todo="Can't set COLUMNS to finite value large enough to include VARIATION SELECTOR-16" \
<<EOF
2009-04-06 01:44 Committer o [master] 🌏💧✋🕋🗡🚀🏜☀️🌡🌶💯🚱⏳🌅🌑😡💉😱😈💀💥🌛🌙🐭💥🚶🏻〰🐛️⌛️👳🙏💥😴🛌😳💥🐛
2009-03-28 13:22 Committer o 💄 Polish the UI
2009-03-20 01:00 Committer o 📚 Document new feature
2009-03-11 12:38 Committer o 🎨 Reformat the code
2009-03-03 00:15 Committer o ✨ Add new feature
2009-02-22 11:53 Committer o 🐧 Fix Linux issue
2009-02-13 23:31 Committer I 🚑 Fix bug
[main] 50a10e108b44c34548b9ba9e318416b3027a0627 - commit 1 of 7 100%
EOF

run_test_cases
25 changes: 13 additions & 12 deletions test/tools/libtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ test_todo_message()
explanation=": $explanation"
fi

printf '[TODO] The test is not expected to pass yet%s\n' "$explanation"
printf '[TODO] Not yet expected to pass%s\n' "$explanation"
}

test_todo()
Expand Down Expand Up @@ -534,15 +534,15 @@ test_case()
printf '%s\n' "$name" >> test-cases
cat > "$name.expected"

touch -- "$name-before" "$name-after" "$name-script" "$name-args" "$name-tigrc" "$name-assert-stderr" "$name-todo"
touch -- "$name-before" "$name-after" "$name-script" "$name-args" "$name-tigrc" "$name-assert-stderr" "$name-todo" "$name-subshell"

while [ "$#" -gt 0 ]; do
arg="$1"; shift
key="$(expr "X$arg" : 'X--\([^=]*\).*')"
value="$(expr "X$arg" : 'X--[^=]*=\(.*\)')"

case "$key" in
before|after|script|args|cwd|tigrc|assert-stderr|todo)
before|after|script|args|cwd|tigrc|assert-stderr|todo|subshell)
printf '%s\n' "$value" > "$name-$key" ;;
*) die "Unknown test_case argument: $arg"
esac
Expand Down Expand Up @@ -572,15 +572,16 @@ run_test_cases()
if [ -e "$name-before" ]; then
test_exec_work_dir "$SHELL" "$HOME/$name-before"
fi
old_work_dir="$work_dir"
if [ -e "$name-cwd" ]; then
work_dir="$work_dir/$(cat < "$name-cwd")"
fi
ORIG_IFS="$IFS"
IFS=' '
test_tig $(if [ -e "$name-args" ]; then cat < "$name-args"; fi)
IFS="$ORIG_IFS"
work_dir="$old_work_dir"
(
if [ -e "$name-cwd" ]; then
work_dir="$work_dir/$(cat < "$name-cwd")"
fi
if [ -e ./"$name-subshell" ]; then
. ./"$name-subshell"
fi
IFS=' '
test_tig $(if [ -e "$name-args" ]; then cat < "$name-args"; fi)
)
if [ -e "$name-after" ]; then
test_exec_work_dir "$SHELL" "$HOME/$name-after"
fi
Expand Down

0 comments on commit 7e9afc7

Please sign in to comment.