1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
#!/bin/sh
#
# Test tigrc parsing errors.
. libtest.sh
export LINES=20
tigrc <<EOF
s # Unknown command
set # Missing name, equals and value
set ignore-space # Missing equals and value
set ignore-space = # Missing value
set ignore-space=no # Missing space
set something = jada # Unknown settings name
set ignore-space = jada # Bad enum value
set tab-size = long # Bad int value
set split-view-height = half # Bad scale value
set split-view-height = 110% # Bad scale value
set split-view-height = -10% # Bad scale value
bind # Missing map, key and action
bind generic # Missing key and action
bind generic B # Missing action
bind generic # refresh # Must use Hash instead of '#'
color # Missing area and colors
color file # Missing colors
color grep.file # Missing colors
color file green # Missing fg color
color file green bold # Attribute used as fg color
color file dark green # Unknown color
color file green dark # Unknown color
color file green green normally # Unknown attribute
# Test that lines continue correctly \\
ignored \\
set main-view = \\
line-number \\
commit-title # Multi-line option
set main_view_line_number_visibility = yes
bind generic " edit
bind generic ' options
bind generic " @sh -c "echo %(commit) | pbcopy"
bind generic ' !sh -c 'git | tig'
bind generic : prompt # Must have prompt mapping
bind generic ø view-tree # Binding to UTF-8 keys
bind main <Hash> :/s e a r c h # Toggle option
bind main 1 !external command
bind main 2 @silent command
bind main 3 ?prompted command
bind main 4 <quitting command
bind main 5 +echoed command
bind main 0 !@?<+all modifiers
# Non-ending multi-line command
c\\
o\\
l\\
o\\
r\\
EOF
steps "
:view-help
:9
:enter
:save-display help.screen
"
TIGRC_SYSTEM="should-not-be-loaded"
test_tig status
assert_equals stderr <<EOF
tig warning: ~/.tigrc:1: Unknown option command: s
tig warning: ~/.tigrc:2: Invalid set command: set option = value
tig warning: ~/.tigrc:3: Invalid set command: set option = value
tig warning: ~/.tigrc:4: Invalid set command: set option = value
tig warning: ~/.tigrc:5: Invalid set command: set option = value
tig warning: ~/.tigrc:6: Unknown option name: something
tig warning: ~/.tigrc:7: 'jada' is not a valid value for ignore-space; using no
tig warning: ~/.tigrc:8: Value must be between 1 and 1024
tig warning: ~/.tigrc:9: Invalid double or percentage
tig warning: ~/.tigrc:10: Percentage is larger than 100%
tig warning: ~/.tigrc:11: Percentage is less than 0%
tig warning: ~/.tigrc:13: Invalid key binding: bind keymap key action
tig warning: ~/.tigrc:14: Invalid key binding: bind keymap key action
tig warning: ~/.tigrc:15: Invalid key binding: bind keymap key action
tig warning: ~/.tigrc:16: Invalid key binding: bind keymap key action
tig warning: ~/.tigrc:18: Invalid color mapping: color area fgcolor bgcolor [attrs]
tig warning: ~/.tigrc:19: Invalid color mapping: color area fgcolor bgcolor [attrs]
tig warning: ~/.tigrc:20: Invalid color mapping: color area fgcolor bgcolor [attrs]
tig warning: ~/.tigrc:21: Invalid color mapping: color area fgcolor bgcolor [attrs]
tig warning: ~/.tigrc:22: Unknown color: bold
tig warning: ~/.tigrc:23: Unknown color: dark
tig warning: ~/.tigrc:24: Unknown color: dark
tig warning: ~/.tigrc:25: Unknown color attribute: normally
tig warning: ~/.tigrc:34: Unknown option \`visibility' for column line-number
tig warning: ~/.tigrc:36: Invalid key binding: bind keymap key action
tig warning: ~/.tigrc:37: Invalid key binding: bind keymap key action
tig warning: ~/.tigrc:38: Unknown command flag '%'; expected one of :!?@<+>
tig warning: ~/.tigrc:39: Unknown command flag '|'; expected one of :!?@<+>
tig warning: ~/.tigrc:57: Unknown option command: c
tig warning: Errors while loading HOME/.tigrc.
EOF
assert_equals help.screen <<EOF
Quick reference for tig keybindings:
[-] Collapse all sections
[-] generic bindings
View switching
ø view-tree Show tree view
Misc
: prompt Open the prompt
[-] main bindings
Internal commands:
# :/s e a r c h
External commands:
1 !external command
2 @silent command
3 ?prompted command
4 <quitting command
5 +echoed command
0 @?<+all modifiers
[help] - line 9 of 38 47%
EOF
|