summaryrefslogtreecommitdiffstats
path: root/tests/bell.test
blob: 96b7a7482dddf873a8841fa4370c8ce8db02b9bc (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
# This file is a Tcl script to test out Tk's "bell" command.
# It is organized in the standard fashion for Tcl tests.
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1998-2000 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @(#) $Id: bell.test,v 1.5 2000/05/17 22:44:10 hobbs Exp $

if {[lsearch [namespace children] ::tcltest] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
}

test bell-1.1 {bell command} {
    list [catch {bell a} msg] $msg
} {1 {bad option "a": must be -displayof or -nice}}
test bell-1.2 {bell command} {
    list [catch {bell a b} msg] $msg
} {1 {bad option "a": must be -displayof or -nice}}
test bell-1.3 {bell command} {
    list [catch {bell -displayof gorp} msg] $msg
} {1 {bad window path name "gorp"}}
test bell-1.4 {bell command} {
    list [catch {bell -nice -displayof} msg] $msg
} {1 {wrong # args: should be "bell ?-displayof window? ?-nice?"}}
test bell-1.5 {bell command} {
    list [catch {bell -nice -nice -nice} msg] $msg
} {0 {}}
test bell-1.6 {bell command} {
    list [catch {bell -displayof . -nice} msg] $msg
} {0 {}}
test bell-1.7 {bell command} {
    list [catch {bell -nice -displayof . -nice} msg] $msg
} {1 {wrong # args: should be "bell ?-displayof window? ?-nice?"}}
test bell-1.8 {bell command} {
    puts "Bell should ring now ..."
    flush stdout
    after 200
    bell -displayof .
    after 200
    bell -nice
    after 200
    bell
} {}

# cleanup
::tcltest::cleanupTests
return