blob: a2f490c2029da7acd2b4ae12256dddcd58ce349f (
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
62
63
64
65
66
67
68
69
70
|
# -*- tcl -*-
# Testsuite support specific to 'fileutil::magic'.
# ### ### ### ######### ######### #########
# This file can assume that the general testsupport (see
# devtools/testutilities.tcl) is already loaded and active.
# ### ### ### ######### ######### #########
## Transient variables to hold more complex texts
set xmlData {<?xml version="1.0" encoding="ISO-8859-1"?>
<foobar></foobar>
}
set xmlDataWithDTD {<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foobar SYSTEM bogus.dtd>
<foobar></foobar>
}
set pgpData {-----BEGIN PGP MESSAGE-----
Version: PGP 6.5.8
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
}
# ### ### ### ######### ######### #########
## Creates a series of commands for the creation of small data files
## for various file formats.
foreach {name data} [list \
Empty {} \
Bin "\u0000" \
Elf [cat "\x7F" "ELF" "\x01\x01\x01\x00\x00"] \
Bzip "BZh91AY&SY\x01\x01\x01\x00\x00" \
Gzip "\x1f\x8b\x01\x01\x01\x00\x00" \
Jpeg [cat "\xFF\xD8\xFF\xE0\x00\x10JFIF" "\x00\x01\x02\x01\x01\x2c"] \
Gif "GIF89a\x2b\x00\x40\x00\xf7\xff\x00" \
Png "\x89PNG\x00\x01\x02\x01\x01\x2c" \
Tiff "MM\x00\*\x00\x01\x02\x01\x01\x2c" \
Pdf "%PDF-1.2 \x00\x01\x02\x01\x01\x2c" \
Igwd "IGWD\x00\x01\x02\x01\x01\x2c"
] {
proc make${name}File {} [list makeBinaryFile $data $name]
proc remove${name}File {} [list removeFile $name]
}
foreach {name data} [list \
PS "%!PS-ADOBO-123 EPSF-1.4" \
EPS "%!PS-ADOBO-123 EPSF-1.4" \
Text "simple text" \
Script "#!/bin/tclsh" \
Html "<html></html>" \
Xml $xmlData \
XmlDTD $xmlDataWithDTD \
PGP $pgpData
] {
proc make${name}File {} [list makeFile $data $name]
proc remove${name}File {} [list removeFile $name]
}
# ### ### ### ######### ######### #########
## Clean up the transient globals.
unset xmlData
unset xmlDataWithDTD
unset pgpData
# ### ### ### ######### ######### #########
|