File: tcl_parse

package info (click to toggle)
tcllib 2.0%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 83,560 kB
  • sloc: tcl: 306,798; ansic: 14,272; sh: 3,035; xml: 1,766; yacc: 1,157; pascal: 881; makefile: 124; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (57 lines) | stat: -rw-r--r-- 1,896 bytes parent folder | download | duplicates (3)
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
# -*- tcl -*-
# docparsetcl.testsuite:  tests for the tcl parser.
#
# Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
# All rights reserved.
#
# RCS: @(#) $Id: tcl_parse,v 1.1 2009/04/01 04:27:47 andreas_kupries Exp $

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

source [localPath common]
set mytestdir tcl_data

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

TestFilesProcess $mytestdir ok in out -> n label input data expected {
    test doctools-tcl-parse-${stkimpl}-${setimpl}-${impl}-10.$n "doctools::tcl::parse, $label, ok" -setup {
	struct::tree myresult
    } -body {
	doctools::tcl::parse text myresult $data
	set res {}
	myresult walk root tok {
	    lappend res "[string repeat {....} [myresult depth $tok]]$tok ([dictsort [myresult getall $tok]])"
	}
	join $res \n
    } -cleanup {
	myresult destroy
    } -result $expected
}

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

TestFilesProcess $mytestdir fail in out -> n label input data expected {
    test doctools-tcl-parse-${stkimpl}-${setimpl}-${impl}-11.$n "doctools::tcl::parse, $label, eror message" -setup {
	struct::tree myresult
    } -body {
	doctools::tcl::parse text myresult $data
    } -cleanup {
	myresult destroy
    } -returnCodes error -result $expected
}

TestFilesProcess $mytestdir fail in out-ec -> n label input data expected {
    test doctools-tcl-parse-${stkimpl}-${setimpl}-${impl}-12.$n "doctools::tcl::parse, $label, error code" -setup {
	struct::tree myresult
    } -body {
	# Catch and rethrow using the error code as new message.
	catch { doctools::tcl::parse text myresult $data }
	set ::errorCode
    } -cleanup {
	myresult destroy
    } -result $expected
}

# -------------------------------------------------------------------------
unset input data expected n label res
return