summaryrefslogtreecommitdiffstats
path: root/tcllib/modules/ident/ident.test
blob: e6dc03d1362a985e5e2ba26d7531d62aeeea048d (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
# ident.test --                                                 -*- tcl -*-
#
#	Tests for the ident package
#

# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

testsNeedTcl     8.2
testsNeedTcltest 1.0

testing {
    useLocal ident.tcl ident
}

# -------------------------------------------------------------------------
# Tests
# -------------------------------------------------------------------------

# good responses
test {ident-1.0} {normal response} {
    ident::parse "8888 , 9999 : USERID : UNIX :max"
} {resp-type USERID opsys UNIX user-id max}

test {ident-1.1} {response with charset} {
    ident::parse "8888 , 9999 : USERID : UNIX , utf-8 :max"
} {resp-type USERID opsys UNIX user-id max}

test {ident-1.2} {response with spaces in the user-id} {
    ident::parse "8888 , 9999 : USERID : UNIX , utf-8 : foo bar "
} {resp-type USERID opsys UNIX user-id { foo bar }}

# errors from the server
test {ident-2.0} {error response} {
    ident::parse "2222,3333 : ERROR : NO-USER"
} {resp-type ERROR error NO-USER}

# fatal errors
test {ident-3.0} {empty response} {
    ident::parse ""
} {resp-type FATAL error {Unexpected response:""}}

test {ident-3.1} {nonsense} {
    ident::parse "sadf liubsv"
} {resp-type FATAL error {Unexpected response:"sadf liubsv"}}

# -------------------------------------------------------------------------

testsuiteCleanup

# -------------------------------------------------------------------------