File: ident.test

package info (click to toggle)
tcllib 1.16-dfsg-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 50,040 kB
  • ctags: 18,603
  • sloc: tcl: 156,708; ansic: 14,098; sh: 10,783; xml: 1,766; yacc: 1,114; pascal: 551; makefile: 89; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (54 lines) | stat: -rw-r--r-- 1,585 bytes parent folder | download | duplicates (8)
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

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