File: export

package info (click to toggle)
tcllib 1.20%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 68,064 kB
  • sloc: tcl: 216,842; ansic: 14,250; sh: 2,846; xml: 1,766; yacc: 1,145; pascal: 881; makefile: 107; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (147 lines) | stat: -rw-r--r-- 4,657 bytes parent folder | download | duplicates (6)
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
# -*- tcl -*-
# toc_export.testsuite: Tests for the management of toc export plugins.
#
# Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
# All rights reserved.
#
# RCS: @(#) $Id: export,v 1.2 2009/11/15 05:50:03 andreas_kupries Exp $

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

# Tests are run for all formats we have an export plugin for.

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

set mytestdir      tests/data
set mytestconfig   {fox dog lazy jump}
set mytestincludes [TestFilesGlob $mytestdir]

# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# doctoc markup

# Testing the export of doctoc markup through an exporter manager, for
# all possible configurations.

foreach {k nl in al section} {
    0 0 0 0 -ultracompact
    1 1 0 0 -compact
    2 1 1 0 -indented
    3 1 0 1 -aligned
    4 1 1 1 -indalign
    5 0 1 0 -indented
    6 0 0 1 -aligned
    7 0 1 1 -indalign
} {
    TestFilesProcess $mytestdir ok serial doctoc$section -> n label input data expected {
	test doctools-toc-export-plugin-doctoc-20.$k.$n "doctools::toc::export /doctoc, $label$section, ok" -setup {
	    doctools::toc::export OUT
	    OUT config set newlines $nl
	    OUT config set indented $in
	    OUT config set aligned  $al
	} -body {
	    stripcomments [OUT export serial $data doctoc]
	} -cleanup {
	    OUT destroy
	} -result $expected
    }
}

# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# text markup

TestFilesProcess $mytestdir ok serial text -> n label input data expected {
    test doctools-toc-export-plugin-text-21.$n "doctools::toc::export /text, $label, ok" -setup {
	doctools::toc::export OUT
    } -body {
	OUT export serial $data text
    } -cleanup {
	OUT destroy
    } -result $expected
}

# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# json markup

foreach {k in al section} {
    0 0 0 -ultracompact
    1 1 0 -indented
    2 0 1 -indalign
    3 1 1 -indalign
} {
    TestFilesProcess $mytestdir ok serial json$section -> n label input data expected {
	test doctools-toc-export-plugin-json-22.$k.$n "doctools::toc::export /json, $label$section, ok" -setup {
	    doctools::toc::export OUT
	    OUT config set indented $in
	    OUT config set aligned  $al
	} -body {
	    OUT export serial $data json
	} -cleanup {
	    OUT destroy
	} -result $expected
    }
}

# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# html markup

foreach {k nl in section} {
    0 0 0 -ultracompact
    1 0 1 -indented
    2 1 0 -compact
    3 1 1 -indented
} {
    TestFilesProcess $mytestdir ok serial html$section -> n label input data expected {
	test doctools-toc-export-plugin-html-23.$k.$n "doctools::toc::export /html, $label$section, ok" -setup {
	    doctools::toc::export OUT
	    OUT config set newlines $nl
	    OUT config set indented $in
	    OUT config set user _dummy_
	} -body {
	    striphtmlcomments [OUT export serial $data html] 3
	} -cleanup {
	    OUT destroy
	} -result $expected
    }
}

# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# wiki markup

TestFilesProcess $mytestdir ok serial wiki -> n label input data expected {
    test doctools-toc-export-plugin-wiki-23.$n "doctools::toc::export /wiki, $label, ok" -setup {
	doctools::toc::export OUT
    } -body {
	OUT export serial $data wiki
    } -cleanup {
	OUT destroy
    } -result $expected
}

# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# nroff markup

foreach {k inline section} {
    0 0 -external
    1 1 -inlined
} {
    TestFilesProcess $mytestdir ok serial nroff$section -> n label input data expected {
	test doctools-toc-export-plugin-nroff-24.$k.$n "doctools::toc::export /nroff, $label$section, ok" -setup {
	    doctools::toc::export OUT
	    OUT config set inline $inline
	} -body {
	    stripnroffcomments [stripmanmacros [OUT export serial $data nroff]]
	} -cleanup {
	    OUT destroy
	} -result $expected
    }
}

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