File: quote-test

package info (click to toggle)
tig 2.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,388 kB
  • sloc: ansic: 32,985; sh: 10,118; makefile: 389
file content (63 lines) | stat: -rwxr-xr-x 1,702 bytes parent folder | download | duplicates (5)
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
#!/bin/sh

. libtest.sh
. libgit.sh

LINES=3

tigrc <<EOF
bind generic 1 !@sh -c "echo \"double \$@\" 'quoted' \"shell command\" > $HOME/shell-command.txt"
bind generic 2 !@sh -c 'echo \'single \'\$@ "quoted" \'shell command\' >> $HOME/shell-command.txt'

bind generic 3 :!echo git log "%(prompt Prompt: )"
bind generic 4 :!echo git log -G"%(prompt Prompt: )"
bind generic 5 :!echo git log -G' \' "\" \\\a\b'
bind generic 6 :!echo git log -G"'\'  \" \\\a\b"
EOF

steps "
	1
	2

	3
	|Quoted 'prompt' input|<Enter>
	:save-display quoted-prompt-with-spaces.screen
	4
	|\"Mid-quoted\" prompt input|<Enter>
	:save-display mid-quoted-prompt-with-spaces.screen
	5
	:save-display single-quoted-arg-with-escaped-chars.screen
	6
	:save-display double-quoted-arg-with-escaped-chars.screen
"

in_work_dir create_repo_from_tgz "$base_dir/files/scala-js-benchmarks.tgz"
test_tig

assert_equals stderr <<EOF
EOF

assert_equals 'shell-command.txt' <<EOF
double quoted shell command
single quoted shell command
EOF

assert_equals 'quoted-prompt-with-spaces.screen' <<EOF
git log |Quoted 'prompt' input|
[pager] echo git log |Quoted 'prompt' input| - line 1 of 1                  100%
EOF

assert_equals 'mid-quoted-prompt-with-spaces.screen' <<EOF
git log -G|"Mid-quoted" prompt input|
[pager] echo git log -G|"Mid-quoted" prompt input| - line 1 of 1            100%
EOF

assert_equals 'single-quoted-arg-with-escaped-chars.screen' <<EOF
git log -G ' "" \\ab
[pager] echo git log -G ' "" \\ab - line 1 of 1                              100%
EOF

assert_equals 'double-quoted-arg-with-escaped-chars.screen' <<EOF
git log -G''  " \\ab
[pager] echo git log -G''  " \\ab - line 1 of 1                              100%
EOF