summary refs log blame commit diff stats
path: root/all_tests.py
blob: 6693b8708e2bbabf0b15769277ff525c2a1504b5 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                 



                                                                   





                                        
 



                                                                                       
 
                                                                  


                                                                        
#!/usr/bin/python
"""Run all the tests inside the test/ directory as a test suite."""
if __name__ == '__main__':
	import unittest
	from test import *
	from sys import exit, argv

	try:
		verbosity = int(argv[1])
	except IndexError:
		verbosity = 2

	tests = []
	for key, val in vars().copy().items():
		if key.startswith('tc_'):
			tests.extend(v for k,v in vars(val).items() if type(v) == type)

	suite = unittest.TestSuite(map(unittest.makeSuite, tests))
	result = unittest.TextTestRunner(verbosity=verbosity).run(suite)
	if len(result.errors) + len(result.failures) > 0:
		exit(1)
pan class="cm"> * All trailing white space is OVERWRITTEN with zero. */ extern char *HTStrip(char *s); /* Parse a Name relative to another name. HTParse() * -------------------------------------- * * This returns those parts of a name which are given (and requested) * substituting bits from the related name where necessary. * * On entry, * aName A filename given * relatedName A name relative to which aName is to be parsed * wanted A mask for the bits which are wanted. * * On exit, * returns A pointer to a malloc'd string which MUST BE FREED */ extern char *HTParse(const char *aName, const char *relatedName, int wanted); /* HTParseAnchor(), fast HTParse() specialization * ---------------------------------------------- * * On exit, * returns A pointer within input string (probably to its end '\0') */ extern const char *HTParseAnchor(const char *aName); /* Simplify a filename. HTSimplify() * -------------------- * * A unix-style file is allowed to contain the seqeunce xxx/../ which may * be replaced by "" , and the seqeunce "/./" which may be replaced by "/". * Simplification helps us recognize duplicate filenames. * * Thus, /etc/junk/../fred becomes /etc/fred * /etc/junk/./fred becomes /etc/junk/fred * * but we should NOT change * http://fred.xxx.edu/../.. * * or ../../albert.html */ extern void HTSimplify(char *filename); /* Make Relative Name. HTRelative() * ------------------- * * This function creates and returns a string which gives an expression of * one address as related to another. Where there is no relation, an absolute * address is retured. * * On entry, * Both names must be absolute, fully qualified names of nodes * (no anchor bits) * * On exit, * The return result points to a newly allocated name which, if * parsed by HTParse relative to relatedName, will yield aName. * The caller is responsible for freeing the resulting name later. * */ extern char *HTRelative(const char *aName, const char *relatedName); /* Escape undesirable characters using % HTEscape() * ------------------------------------- * * This function takes a pointer to a string in which * some characters may be unacceptable are unescaped. * It returns a string which has these characters * represented by a '%' character followed by two hex digits. * * Unlike HTUnEscape(), this routine returns a malloc'd string. */ extern char *HTEscape(const char *str, unsigned char mask); /* Escape unsafe characters using % HTEscapeUnsafe() * -------------------------------- * * This function takes a pointer to a string in which * some characters may be that may be unsafe are unescaped. * It returns a string which has these characters * represented by a '%' character followed by two hex digits. * * Unlike HTUnEscape(), this routine returns a malloc'd string. */ extern char *HTEscapeUnsafe(const char *str); /* Escape undesirable characters using % but space to +. HTEscapeSP() * ----------------------------------------------------- * * This function takes a pointer to a string in which * some characters may be unacceptable are unescaped. * It returns a string which has these characters * represented by a '%' character followed by two hex digits, * except that spaces are converted to '+' instead of %2B. * * Unlike HTUnEscape(), this routine returns a malloc'd string. */ extern char *HTEscapeSP(const char *str, unsigned char mask); /* Decode %xx escaped characters. HTUnEscape() * ------------------------------ * * This function takes a pointer to a string in which some * characters may have been encoded in %xy form, where xy is * the acsii hex code for character 16x+y. * The string is converted in place, as it will never grow. */ extern char *HTUnEscape(char *str); /* Decode some %xx escaped characters. HTUnEscapeSome() * ----------------------------------- Klaus Weide * (kweide@tezcat.com) * This function takes a pointer to a string in which some * characters may have been encoded in %xy form, where xy is * the acsii hex code for character 16x+y, and a pointer to * a second string containing one or more characters which * should be unescaped if escaped in the first string. * The first string is converted in place, as it will never grow. */ extern char *HTUnEscapeSome(char *str, const char *do_trans); /* * Turn a string which is not a RFC 822 token into a quoted-string. - KW */ extern void HTMake822Word(char **str, int quoted); #ifdef __cplusplus } #endif #endif /* HTPARSE_H */