File: 100_option_parse.ct

package info (click to toggle)
fsvs 1.2.9-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,976 kB
  • sloc: ansic: 16,660; sh: 5,891; perl: 783; makefile: 344; python: 90
file content (54 lines) | stat: -rw-r--r-- 1,337 bytes parent folder | download | duplicates (7)
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
## Stops automatically in _do_component_tests.
## Test for option parsing.

set debuglevel=1

set opt__list[OPT__FILTER].i_val=0
set opt__list[OPT__FILTER].prio=0
#= 0
print opt__list[OPT__FILTER].i_val
print opt__list[OPT__FILTER].prio

# With gdb 6.8.50 or something like that this doesn't work anymore.
# set buffer="filter=any"
set strcpy(buffer, "filter=any")
call opt__parse(buffer, 0, 1, 0)
#= -1
print opt__list[OPT__FILTER].i_val

# Now we have to set both strings, because strcpy() doesn't go beyond \0.
# Or we could use memcpy ... but that's fragile if the value gets changed.
set strcpy(buffer, "filter")
set strcpy(buffer+10, "none;text")
set opt_debugprefix=0
call opt__parse(buffer, buffer+10, 2, 0)
#= 7
print opt__list[OPT__FILTER].i_val

set strcpy(buffer, "filter=none")
call opt__parse(buffer, 0, 3, 0)
#= 0
print opt__list[OPT__FILTER].i_val


call strcpy(buffer, "filter=mtime,owner:group")
call opt__parse(buffer, 0, 4, 0)
#= 0xe0
print /x opt__list[OPT__FILTER].i_val


set strcpy(buffer, "delay=no")
call opt__parse(buffer, 0, 1, 0)
#= 0
print opt__list[OPT__DELAY].i_val

set strcpy(buffer, "delay=yes")
call opt__parse(buffer, 0, 2, 0)
#= -1
print opt__list[OPT__DELAY].i_val

set strcpy(buffer, "delay=commit,update,checkout,revert")
call opt__parse(buffer, 0, 3, 0)
#= 15
print opt__list[OPT__DELAY].i_val