comparison tests/test-highlight.t @ 27996:4301b99126ef

test-highlight: factor out function that normalizes pygments output
author Yuya Nishihara <yuya@tcha.org>
date Tue, 26 Jan 2016 23:27:12 +0900
parents 834d27c4655d
children bc2dd19b9534
comparison
equal deleted inserted replaced
27995:834d27c4655d 27996:4301b99126ef
7 > pygments_style = friendly 7 > pygments_style = friendly
8 > highlightfiles = **.py and size('<100KB') 8 > highlightfiles = **.py and size('<100KB')
9 > EOF 9 > EOF
10 $ hg init test 10 $ hg init test
11 $ cd test 11 $ cd test
12
13 $ filterhtml () {
14 > sed -e "s/class=\"k\"/class=\"kn\"/g" \
15 > -e "s/class=\"mf\"/class=\"mi\"/g"
16 > }
12 17
13 create random Python file to exercise Pygments 18 create random Python file to exercise Pygments
14 19
15 $ cat <<EOF > primes.py 20 $ cat <<EOF > primes.py
16 > #!/usr/bin/env python 21 > #!/usr/bin/env python
55 $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log 60 $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log
56 $ cat hg.pid >> $DAEMON_PIDS 61 $ cat hg.pid >> $DAEMON_PIDS
57 62
58 hgweb filerevision, html 63 hgweb filerevision, html
59 64
60 $ (get-with-headers.py localhost:$HGPORT 'file/tip/primes.py') \ 65 $ (get-with-headers.py localhost:$HGPORT 'file/tip/primes.py') | filterhtml
61 > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mf\"/class=\"mi\"/g"
62 200 Script output follows 66 200 Script output follows
63 67
64 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 68 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
65 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> 69 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
66 <head> 70 <head>
188 </html> 192 </html>
189 193
190 194
191 hgweb fileannotate, html 195 hgweb fileannotate, html
192 196
193 $ (get-with-headers.py localhost:$HGPORT 'annotate/tip/primes.py') \ 197 $ (get-with-headers.py localhost:$HGPORT 'annotate/tip/primes.py') | filterhtml
194 > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mf\"/class=\"mi\"/g"
195 200 Script output follows 198 200 Script output follows
196 199
197 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 200 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
198 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> 201 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
199 <head> 202 <head>