# -*- 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 { } set xmlDataWithDTD { } 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 "" \ 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 # ### ### ### ######### ######### #########