# HG changeset patch # User Christian Ebert # Date 2009-04-04 13:14:36 # Node ID 5fb6edbf0ab8659d05e2751dff836af4313f936c # Parent 73fa2be69ea9de7cbb0f007e74463c2a308c8d75 tests: guess lexer by filename for recent pygments Recent pygments guess AntlrJavaLexer for the isolatin text, converted to ascii by util.tolocal, which yields class="err". Guess lexer by extension instead. diff --git a/tests/test-highlight b/tests/test-highlight --- a/tests/test-highlight +++ b/tests/test-highlight @@ -14,7 +14,7 @@ cd test cp $TESTDIR/get-with-headers.py ./ # check for UnicodeDecodeError with iso-8859-1 file contents -python -c 'fp = open("isolatin", "w"); fp.write("h\xFCbsch\n"); fp.close();' +python -c 'fp = open("isolatin.txt", "w"); fp.write("h\xFCbsch\n"); fp.close();' hg ci -Ama @@ -27,7 +27,7 @@ echo % hgweb filerevision, html | sed "s/class=\"k\"/class=\"kn\"/g" echo % hgweb filerevision, html -("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/isolatin') \ +("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/isolatin.txt') \ | sed "s/class=\"k\"/class=\"kn\"/g" echo % hgweb fileannotate, html diff --git a/tests/test-highlight.out b/tests/test-highlight.out --- a/tests/test-highlight.out +++ b/tests/test-highlight.out @@ -1,5 +1,5 @@ adding get-with-headers.py -adding isolatin +adding isolatin.txt % hg serve % hgweb filerevision, html 200 Script output follows @@ -12,7 +12,7 @@ 200 Script output follows -test: e55e3a42c53a get-with-headers.py +test: 7c3facd7c58a get-with-headers.py @@ -23,26 +23,26 @@ 200 Script output follows mercurial

test

-

view get-with-headers.py @ 0:e55e3a42c53a

+

view get-with-headers.py @ 0:7c3facd7c58a

test

-

view isolatin @ 0:e55e3a42c53a

+

view isolatin.txt @ 0:7c3facd7c58a

@@ -193,27 +193,27 @@ 200 Script output follows mercurial

test

-

annotate get-with-headers.py @ 0:e55e3a42c53a

+

annotate get-with-headers.py @ 0:7c3facd7c58a

@@ -252,7 +252,7 @@ files, or words in the commit messagerev   line source -test@0 1 #!/usr/bin/env pythontest@0 2 test@0 3 __doc__ = """This does HTTP get requests given a host:port and path and returnstest@0 4 a subset of the headers plus the body of the result."""test@0 5 test@0 6 import httplib, sys, retest@0 7 test@0 8 try:test@0 9 import msvcrt, ostest@0 10 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)test@0 11 msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)test@0 12 except ImportError:test@0 13 passtest@0 14 test@0 15 headers = [h.lower() for h in sys.argv[3:]]test@0 16 conn = httplib.HTTPConnection(sys.argv[1])test@0 17 conn.request("GET", sys.argv[2])test@0 18 response = conn.getresponse()test@0 19 print response.status, response.reasontest@0 20 for h in headers:test@0 21 if response.getheader(h, None) is not None:test@0 22 print "%s: %s" % (h, response.getheader(h))test@0 23 printtest@0 24 data = response.read()test@0 25 data = re.sub('\d+ years', 'many years', data)test@0 26 sys.stdout.write(data)test@0 27 test@0 28 if 200 <= response.status <= 299:test@0 29 sys.exit(0)test@0 30 sys.exit(1) +test@0 1 #!/usr/bin/env pythontest@0 2 test@0 3 __doc__ = """This does HTTP get requests given a host:port and path and returnstest@0 4 a subset of the headers plus the body of the result."""test@0 5 test@0 6 import httplib, sys, retest@0 7 test@0 8 try:test@0 9 import msvcrt, ostest@0 10 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)test@0 11 msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)test@0 12 except ImportError:test@0 13 passtest@0 14 test@0 15 headers = [h.lower() for h in sys.argv[3:]]test@0 16 conn = httplib.HTTPConnection(sys.argv[1])test@0 17 conn.request("GET", sys.argv[2])test@0 18 response = conn.getresponse()test@0 19 print response.status, response.reasontest@0 20 for h in headers:test@0 21 if response.getheader(h, None) is not None:test@0 22 print "%s: %s" % (h, response.getheader(h))test@0 23 printtest@0 24 data = response.read()test@0 25 data = re.sub('\d+ years', 'many years', data)test@0 26 sys.stdout.write(data)test@0 27 test@0 28 if 200 <= response.status <= 299:test@0 29 sys.exit(0)test@0 30 sys.exit(1)