aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/options.exp
blob: 3b4e7ee189f4c0e5e2535aadefa22d3140d6967e (plain)
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
# This testcase is part of GDB, the GNU debugger.

# Copyright 2019 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Test the gdb::option framework.

# The test uses the "maintenance test-options" subcommands to exercise
# TAB-completion and option processing.
#
# It also tests option integration in various commands, including
# "print" and "compile print".

load_lib completion-support.exp

standard_testfile .c

if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
    return -1
}

clean_restart

if { ![readline_is_used] } {
    untested "no tab completion support without readline"
    return -1
}

# Check the completion result, as returned by the "maintenance show
# test-options-completion-result" command.  TEST is used as test name.
proc check_completion_result {expected test} {
    gdb_test "maintenance show test-options-completion-result" \
	"$expected" \
	"$test: res=$expected"
}

# Like test_gdb_complete_unique, but the expected output is expected
# to be the input line.  I.e., the line is already complete.  We're
# just checking whether GDB recognizes the option and auto-appends a
# space.
proc test_completer_recognizes {res input_line} {
    set expected_re [string_to_regexp $input_line]
    test_gdb_complete_unique $input_line $expected_re
    check_completion_result $res $input_line
}

# Wrapper around test_gdb_complete_multiple that also checks the
# completion result is RES.
proc res_test_gdb_complete_multiple {res cmd_prefix completion_word args} {
    test_gdb_complete_multiple $cmd_prefix $completion_word {*}$args
    check_completion_result $res "$cmd_prefix$completion_word"
}

# Wrapper around test_gdb_complete_none that also checks the
# completion result is RES.
proc res_test_gdb_complete_none { res input_line } {
    test_gdb_complete_none $input_line
    check_completion_result $res "$input_line"
}

# Wrapper around test_gdb_complete_unique that also checks the
# completion result is RES.
proc res_test_gdb_complete_unique { res input_line args} {
    test_gdb_complete_unique $input_line {*}$args
    check_completion_result $res "$input_line"
}

# Make a full command name from VARIANT.  VARIANT is either
# "require-delimiter", "unknown-is-error" or "unknown-is-operand".
proc make_cmd {variant} {
    return "maint test-options $variant"
}

# Return a string for the expected result of running "maint
# test-options xxx", with no flag/option set.  OPERAND is the expected
# operand.
proc expect_none {operand} {
    return "-flag 0 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint 0 -zuint-unl 0 -- $operand"
}

# Return a string for the expected result of running "maint
# test-options xxx", with -flag set.  OPERAND is the expected operand.
proc expect_flag {operand} {
    return "-flag 1 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint 0 -zuint-unl 0 -- $operand"
}

# Return a string for the expected result of running "maint
# test-options xxx", with -bool set.  OPERAND is the expected operand.
proc expect_bool {operand} {
    return "-flag 0 -xx1 0 -xx2 0 -bool 1 -enum xxx -uint 0 -zuint-unl 0 -- $operand"
}

# Return a string for the expected result of running "maint
# test-options xxx", with one of the integer options set to $VAL.
# OPTION determines which option to expect set.  OPERAND is the
# expected operand.
proc expect_integer {option val operand} {
    if {$option == "uinteger"} {
	return "-flag 0 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint $val -zuint-unl 0 -- $operand"
    } elseif {$option == "zuinteger-unlimited"} {
	return "-flag 0 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint 0 -zuint-unl $val -- $operand"
    } else {
	error "unsupported option: $option"
    }
}

set all_options {
    "-bool"
    "-enum"
    "-flag"
    "-uinteger"
    "-xx1"
    "-xx2"
    "-zuinteger-unlimited"
}

# Basic option-machinery + "print" command integration tests.
proc_with_prefix test-print {{prefix ""}} {
    clean_restart

    # Completing "print" with no argument completes on symbols only,
    # no options are offered.  Since we haven't loaded any symbols,
    # the match list should be empty.
    test_gdb_complete_none "${prefix}print "

    # OTOH, completing at "-" should list all options.
    test_gdb_complete_multiple "${prefix}print " "-" "" {
	"-address"
	"-array"
	"-array-indexes"
	"-elements"
	"-max-depth"
	"-null-stop"
	"-object"
	"-pretty"
	"-repeats"
	"-static-members"
	"-symbol"
	"-union"
	"-vtbl"
    }

    global binfile
    clean_restart $binfile

    if ![runto_main] {
	fail "cannot run to main"
	return
    }

    # Mix options and format.
    gdb_test "${prefix}print -pretty -- /x 1" " = 0x1"

    # Smoke test that options actually work.
    gdb_test "${prefix}print -pretty -- g_s" \
	[multi_line  \
	     " = {" \
	     "  a = 1," \
	     "  b = 2," \
	     "  c = 3" \
	     "}"]

    test_gdb_complete_unique \
	"${prefix}print xxx" \
	"${prefix}print xxx1"
    test_gdb_complete_unique \
	"${prefix}print -- xxx" \
	"${prefix}print -- xxx1"

    # Error messages when testing with "compile" are different from
    # the error messages gdb's internal parser throws.  This procedure
    # hides the difference.  EXPECTED_RE is only considered when not
    # testing with "compile".
    proc test_invalid_expression {cmd expected_re} {
	upvar prefix prefix

	if {$prefix != "compile "} {
	    gdb_test $cmd $expected_re
	} else {
	    # Error messages depend on compiler version, so we just
	    # look for the last line indicating a failure.
	    gdb_test $cmd "Compilation failed\\."
	}
    }

    # Check that '-XXX' without a "--" is handled as an
    # expression.
    gdb_test "${prefix}print -1" " = -1"
    test_invalid_expression \
	"${prefix}print --1" \
	"Left operand of assignment is not an lvalue\\."
    test_invalid_expression \
	"${prefix}print -object" \
	"No symbol \"object\".*"

    # Test printing with options and no expression.
    set test "${prefix}print -object --"
    if {$prefix != "compile "} {
	# Regular "print" repeats the last history value.
	gdb_test $test " = -1"
    } else {
	# "compile print" starts a multiline expression.
	gdb_test_multiple $test $test {
	    -re ">$" {
		gdb_test "-1\nend" " = -1" \
		    $test
	    }
	}
    }

    # Check that everything after "-- " is treated as an
    # expression, not confused with an option.
    test_invalid_expression \
	"${prefix}print -- -address" \
	"No symbol.*"
    gdb_test "${prefix}print -- -1" " = -1"
    test_invalid_expression \
	"${prefix}print -- --1" \
	"Left operand of assignment is not an lvalue\\."
}

# Miscellaneous tests.
proc_with_prefix test-misc {variant} {
    global all_options

    set cmd [make_cmd $variant]

    # Call test command with no arguments at all.
    gdb_test "$cmd" [expect_none ""]

    # Now with a single dash.
    if {$variant == "require-delimiter"} {
	gdb_test "$cmd -" [expect_none "-"]
    } else {
	gdb_test "$cmd -" "Ambiguous option at: -"
    }

    # Completing at "-" should list all options.
    res_test_gdb_complete_multiple "1" "$cmd " "-" "" $all_options

    # Now with a double dash.
    gdb_test "$cmd --" [expect_none ""]

    # "--" is recognized by options completer, gdb auto-appends a
    # space.
    test_completer_recognizes 1 "$cmd --"

    # Now with a double dash, plus a dash as operand.
    gdb_test "$cmd -- -" [expect_none "-"]
    res_test_gdb_complete_none "0 -" "$cmd -- -"

    # Completing an unambiguous option just appends an empty space.
    test_completer_recognizes 1 "$cmd -flag"

    # Try running an ambiguous option.
    if {$variant == "require-delimiter"} {
	gdb_test "$cmd -xx" [expect_none "-xx"]
    } else {
	gdb_test "$cmd -xx" "Ambiguous option at: -xx"
    }

    # Check that options are not case insensitive.
    gdb_test "$cmd -flag --" [expect_flag ""]

    # Check how the different modes behave on unknown option, with a
    # delimiter.
    gdb_test "$cmd -FLAG --" \
	"Unrecognized option at: -FLAG --"

    # Check how the different modes behave on unknown option, without
    # a delimiter.
    if {$variant == "unknown-is-error"} {
	gdb_test "$cmd -FLAG" \
	    "Unrecognized option at: -FLAG"
    } else {
	gdb_test "$cmd -FLAG" [expect_none "-FLAG"]
    }

    # Test parsing stops at a negative integer.
    gdb_test "$cmd -1 --" \
	"Unrecognized option at: -1 --"
    gdb_test "$cmd -2 --" \
	"Unrecognized option at: -2 --"
}

# Flag option tests.
proc_with_prefix test-flag {variant} {
    global all_options

    set cmd [make_cmd $variant]

    # Completing a flag just appends a space.
    test_completer_recognizes 1 "$cmd -flag"

    # Add a dash, and all options should be shown.
    test_gdb_complete_multiple "$cmd  -flag " "-" "" $all_options

    # Basic smoke tests of accepted / not accepted values.

    # Check all the different variants a bool option may be specified.
    if {$variant == "require-delimiter"} {
	gdb_test "$cmd -flag 999" [expect_none "-flag 999"]
    } else {
	gdb_test "$cmd -flag 999" [expect_flag "999"]
    }
    gdb_test "$cmd -flag -- 999" [expect_flag "999"]

    # If the "--" separator is present, then GDB errors out if the
    # flag option is passed some value -- check that too.
    gdb_test "$cmd -flag xxx 999 --" "Unrecognized option at: xxx 999 --"
    gdb_test "$cmd -flag o 999 --" "Unrecognized option at: o 999 --"
    gdb_test "$cmd -flag 1 999 --" "Unrecognized option at: 1 999 --"

    # Extract twice the same flag, separated by one space.
    gdb_test "$cmd -flag -flag -- non flags args" \
	[expect_flag "non flags args"]

    # Extract twice the same flag, separated by one space.
    gdb_test "$cmd -xx1     -xx2 -xx1  -xx2 -xx1    -- non flags args" \
	"-flag 0 -xx1 1 -xx2 1 -bool 0 -enum xxx -uint 0 -zuint-unl 0 -- non flags args"

    # Extract 2 known flags in front of unknown flags.
    gdb_test "$cmd -xx1 -xx2 -a -b -c -xx1 --" \
	"Unrecognized option at: -a -b -c -xx1 --"

    # Check that combined flags are not recognised.
    gdb_test "$cmd -xx1 -xx1xx2 -xx1 --" \
	"Unrecognized option at: -xx1xx2 -xx1 --"

    # Make sure the completer don't confuse a flag option with a
    # boolean option.  Specifically, "o" should not complete to
    # "on/off".

    if {$variant == "require-delimiter"} {
	res_test_gdb_complete_none "1" "$cmd -flag o"

	gdb_test "$cmd -flag o" [expect_none "-flag o"]
    } else {
	res_test_gdb_complete_none "0 o" "$cmd -flag o"

	gdb_test "$cmd -flag o" [expect_flag "o"]
    }
}

# Boolean option tests.
proc_with_prefix test-boolean {variant} {
    global all_options

    set cmd [make_cmd $variant]

    # Boolean option's values are optional -- "on" is implied.  Check
    # that:
    #
    # - For require-delimiter commands, completing after a boolean
    #   option lists all other options, plus "on/off".  This is
    #   because operands won't be processed until we see a "--"
    #   delimiter.
    #
    # - For !require-delimiter commands, completing after a boolean
    #   option completes as an operand, since that will tend to be
    #   more common than typing "on/off".
    #   E.g., "frame apply all -past-main COMMAND".

    if {$variant == "require-delimiter"} {
	res_test_gdb_complete_multiple 1 "$cmd -bool " "" "" {
	    "-bool"
	    "-enum"
	    "-flag"
	    "-uinteger"
	    "-xx1"
	    "-xx2"
	    "-zuinteger-unlimited"
	    "off"
	    "on"
	}
    } else {
	res_test_gdb_complete_none "0 " "$cmd -bool "
    }

    # Add another dash, and "on/off" are no longer offered:
    res_test_gdb_complete_multiple 1 "$cmd -bool " "-" ""  $all_options

    # Basic smoke tests of accepted / not accepted values.

    # The command accepts all of "1/0/enable/disable/yes/no" too, even
    # though like the "set" command, we don't offer those as
    # completion candidates if you complete right after the boolean
    # command's name, like:
    #
    #  (gdb) maint test-options require-delimiter -bool [TAB]
    #  off        on
    #
    # However, the completer does recognize them if you start typing
    # the boolean value.
    foreach value {"0" "1"} {
	test_completer_recognizes 1 "$cmd -bool $value"
    }
    foreach value {"of" "off"} {
	res_test_gdb_complete_unique 1 \
	    "$cmd -bool $value" \
	    "$cmd -bool off"
    }
    foreach value {"y" "ye" "yes"} {
	res_test_gdb_complete_unique 1 \
	    "$cmd -bool $value" \
	    "$cmd -bool yes"
    }
    foreach value {"n" "no"} {
	res_test_gdb_complete_unique 1 \
	    "$cmd -bool $value" \
	    "$cmd -bool no"
    }
    foreach value {
	"e"
	"en"
	"ena"
	"enab"
	"enabl"
	"enable"
    } {
	res_test_gdb_complete_unique 1 \
	    "$cmd -bool $value" \
	    "$cmd -bool enable"
    }
    foreach value {
	"d"
	"di"
	"dis"
	"disa"
	"disab"
	"disabl"
	"disable"
    } {
	res_test_gdb_complete_unique 1 \
	    "$cmd -bool $value" \
	    "$cmd -bool disable"
    }

    if {$variant == "require-delimiter"} {
	res_test_gdb_complete_none "1" "$cmd -bool xxx"
    } else {
	res_test_gdb_complete_none "0 xxx" "$cmd -bool xxx"
    }

    # The command accepts abbreviations of "enable/disable/yes/no",
    # even though we don't offer those for completion.
    foreach value {
	"1"
	"y" "ye" "yes"
	"e"
	"en"
	"ena"
	"enab"
	"enabl"
	"enable"} {
	gdb_test "$cmd -bool $value --" [expect_bool ""]
    }
    foreach value {
	"0"
	"of" "off"
	"n" "no"
	"d"
	"di"
	"dis"
	"disa"
	"disab"
	"disabl"
	"disable"} {
	gdb_test "$cmd -bool $value --" [expect_none ""]
    }

    if {$variant == "require-delimiter"} {
	gdb_test "$cmd -bool 999" [expect_none "-bool 999"]
    } else {
	gdb_test "$cmd -bool 999" [expect_bool "999"]
    }
    gdb_test "$cmd -bool -- 999" [expect_bool "999"]

    # Since "on" is implied after a boolean option, for
    # !require-delimiter commands, anything that is not
    # yes/no/1/0/on/off/enable/disable should be considered as the raw
    # input after the last option.  Also check "o", which might look
    # like "on" or "off", but it's treated the same.

    foreach arg {"xxx" "o"} {
	if {$variant == "require-delimiter"} {
	    gdb_test "$cmd -bool $arg" [expect_none "-bool $arg"]
	} else {
	    gdb_test "$cmd -bool $arg" [expect_bool "$arg"]
	}
    }
    # Also try -1.  "unknown-is-error" commands error out saying that
    # that's not a valid option.
    if {$variant == "require-delimiter"} {
	gdb_test "$cmd -bool -1" \
	     [expect_none "-bool -1"]
    } elseif {$variant == "unknown-is-error"} {
	gdb_test "$cmd -bool -1" \
	    "Unrecognized option at: -1"
    } else {
	gdb_test "$cmd -bool -1" [expect_bool "-1"]
    }

    # OTOH, if the "--" separator is present, then GDB errors out if
    # the boolean option is passed an invalid value -- check that too.
    gdb_test "$cmd -bool -1 999 --" \
	"Unrecognized option at: -1 999 --"
    gdb_test "$cmd -bool xxx 999 --" \
	"Value given for `-bool' is not a boolean: xxx"
    gdb_test "$cmd -bool o 999 --" \
	"Value given for `-bool' is not a boolean: o"

    # Completing after a boolean option + "o" does list "on/off",
    # though.
    if {$variant == "require-delimiter"} {
	res_test_gdb_complete_multiple 1 "$cmd -bool " "o" "" {
	    "off"
	    "on"
	}
    } else {
	res_test_gdb_complete_multiple "0 o" "$cmd -bool " "o" "" {
	    "off"
	    "on"
	}
    }
}

# Uinteger option tests.  OPTION is which integer option we're
# testing.  Can be "uinteger" or "zuinteger-unlimited".
proc_with_prefix test-uinteger {variant option} {
    global all_options

    set cmd "[make_cmd $variant] -$option"

    # Test completing a uinteger option:
    res_test_gdb_complete_multiple 1 "$cmd " "" "" {
	"NUMBER"
	"unlimited"
    }

    # NUMBER above is just a placeholder, make sure we don't complete
    # it as a valid option.
    res_test_gdb_complete_none 1 "$cmd NU"

    # "unlimited" is valid though.
    res_test_gdb_complete_unique 1 \
	"$cmd u" \
	"$cmd unlimited"

    # Basic smoke test of accepted / not accepted values.
    gdb_test "$cmd 1 -- 999" [expect_integer $option "1" "999"]
    gdb_test "$cmd unlimited -- 999" \
	[expect_integer $option "unlimited" "999"]
    if {$option == "zuinteger-unlimited"} {
	gdb_test "$cmd -1 --" [expect_integer $option "unlimited" ""]
	gdb_test "$cmd 0 --" [expect_integer $option "0" ""]
    } else {
	gdb_test "$cmd -1 --" "integer -1 out of range"
	gdb_test "$cmd 0 --" [expect_integer $option "unlimited" ""]
    }
    gdb_test "$cmd xxx --" \
	"Expected integer at: xxx --"
    gdb_test "$cmd unlimitedx --" \
	"Expected integer at: unlimitedx --"

    # Don't offer completions until we're past the
    # -uinteger/-zuinteger-unlimited argument.
    res_test_gdb_complete_none 1 "$cmd 1"

    # A number of invalid values.
    foreach value {"x" "x " "1a" "1a " "1-" "1- " "unlimitedx"} {
	res_test_gdb_complete_none 1 "$cmd $value"
    }

    # Try "-1".
    if {$option == "uinteger"} {
	# -1 is invalid uinteger.
	foreach value {"-1" "-1 "} {
	    res_test_gdb_complete_none 1 "$cmd $value"
	}
    } else {
	# -1 is valid for zuinteger-unlimited.
	res_test_gdb_complete_none 1 "$cmd -1"
	if {$variant == "require-delimiter"} {
	    res_test_gdb_complete_multiple 1 "$cmd -1 " "" "-" $all_options
	} else {
	    res_test_gdb_complete_none "0 " "$cmd -1 "
	}
    }

    # Check that after a fully parsed option:
    #
    #  - for require-delimiter commands, completion offers all
    #    options.
    #
    #  - for !require-delimiter commands, completion offers nothing
    #    and returns false.
    if {$variant == "require-delimiter"} {
	res_test_gdb_complete_multiple 1 "$cmd 1 " "" "-" $all_options
    } else {
	res_test_gdb_complete_none "0 " "$cmd 1 "
    }

    # Test completing non-option arguments after "-uinteger 1 ".
    foreach operand {"x" "x " "1a" "1a " "1-" "1- "} {
	if {$variant == "require-delimiter"} {
	    res_test_gdb_complete_none 1 "$cmd 1 $operand"
	} else {
	    res_test_gdb_complete_none "0 $operand" "$cmd 1 $operand"
	}
    }
    # These look like options, but they aren't.
    foreach operand {"-1" "-1 "} {
	if {$variant == "unknown-is-operand"} {
	    res_test_gdb_complete_none "0 $operand" "$cmd 1 $operand"
	} else {
	    res_test_gdb_complete_none 1 "$cmd 1 $operand"
	}
    }
}

# Enum option tests.
proc_with_prefix test-enum {variant} {
    set cmd [make_cmd $variant]

    res_test_gdb_complete_multiple 1 "$cmd -enum " "" "" {
	"xxx"
	"yyy"
	"zzz"
    }

    # Check that "-" where a value is expected does not show the
    # command's options.  I.e., an enum's value is not optional.
    # Check both completion and running the command.
    res_test_gdb_complete_none 1 "$cmd -enum -"
    gdb_test "$cmd -enum --"\
	"Requires an argument. Valid arguments are xxx, yyy, zzz\\."

    # Try passing an undefined item to an enum option.
    gdb_test "$cmd -enum www --" "Undefined item: \"www\"."
}

# Run the options framework tests first.
foreach_with_prefix cmd {
    "require-delimiter"
    "unknown-is-error"
    "unknown-is-operand"
} {
    test-misc $cmd
    test-flag $cmd
    test-boolean $cmd
    foreach subcmd {"uinteger" "zuinteger-unlimited" } {
	test-uinteger $cmd $subcmd
    }
    test-enum $cmd
}

# Run the print integration tests.
test-print ""

# Same for "compile print".
if ![skip_compile_feature_tests] {
    test-print "compile "
}