From patchwork Fri May 31 10:51:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5, of, 5, V2] tests: modify tests according to changes in last hgweb commits From: Alexander Plavin X-Patchwork-Id: 1683 Message-Id: <3dc48ea515416908d732.1369997517@debian-alexander.dolgopa> To: mercurial-devel@selenic.com Date: Fri, 31 May 2013 14:51:57 +0400 # HG changeset patch # User Alexander Plavin # Date 1369995940 -14400 # Fri May 31 14:25:40 2013 +0400 # Node ID 3dc48ea515416908d732b199a39b8ba0b6c9dcb7 # Parent 746e1cd797846b7b46f5fe497bc2e43153fcd143 tests: modify tests according to changes in last hgweb commits This is a separate commit to modify the tests only once and not to clutter diffs. diff -r 746e1cd79784 -r 3dc48ea51541 tests/test-help.t --- a/tests/test-help.t Fri May 31 13:17:59 2013 +0400 +++ b/tests/test-help.t Fri May 31 14:25:40 2013 +0400 @@ -1456,7 +1456,11 @@ - + @@ -1622,7 +1626,11 @@ - + @@ -1818,7 +1826,11 @@ - + @@ -1913,7 +1925,11 @@ - + diff -r 746e1cd79784 -r 3dc48ea51541 tests/test-hgweb-commands.t --- a/tests/test-hgweb-commands.t Fri May 31 13:17:59 2013 +0400 +++ b/tests/test-hgweb-commands.t Fri May 31 14:25:40 2013 +0400 @@ -338,7 +338,11 @@ - + @@ -450,22 +454,26 @@
-
line diff
+
-
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-       1.2 +++ b/da/foo	Thu Jan 01 00:00:00 1970 +0000
-       1.3 @@ -0,0 +1,1 @@
-       1.4 +foo
-  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-       2.2 +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
-       2.3 @@ -0,0 +1,1 @@
-       2.4 +foo
-  
+
  1. --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +
  2. +++ b/da/foo Thu Jan 01 00:00:00 1970 +0000 +
  3. @@ -0,0 +1,1 @@ +
  4. +foo +
  1. --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +
  2. +++ b/foo Thu Jan 01 00:00:00 1970 +0000 +
  3. @@ -0,0 +1,1 @@ +
  4. +foo +
- + @@ -557,7 +565,11 @@ - + @@ -667,16 +679,22 @@
-
line source
+
+
    -
    1 foo -
    +
  1. foo +
  2. +
- + diff -r 746e1cd79784 -r 3dc48ea51541 tests/test-hgweb-descend-empties.t --- a/tests/test-hgweb-descend-empties.t Fri May 31 13:17:59 2013 +0400 +++ b/tests/test-hgweb-descend-empties.t Fri May 31 14:25:40 2013 +0400 @@ -132,7 +132,11 @@ - + diff -r 746e1cd79784 -r 3dc48ea51541 tests/test-hgweb-diffs.t --- a/tests/test-hgweb-diffs.t Fri May 31 13:17:59 2013 +0400 +++ b/tests/test-hgweb-diffs.t Fri May 31 14:25:40 2013 +0400 @@ -142,22 +142,26 @@
-
line diff
+
-
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-       1.2 +++ b/a	Thu Jan 01 00:00:00 1970 +0000
-       1.3 @@ -0,0 +1,1 @@
-       1.4 +a
-  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-       2.2 +++ b/b	Thu Jan 01 00:00:00 1970 +0000
-       2.3 @@ -0,0 +1,1 @@
-       2.4 +b
-  
+
  1. --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +
  2. +++ b/a Thu Jan 01 00:00:00 1970 +0000 +
  3. @@ -0,0 +1,1 @@ +
  4. +a +
  1. --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +
  2. +++ b/b Thu Jan 01 00:00:00 1970 +0000 +
  3. @@ -0,0 +1,1 @@ +
  4. +b +
- + @@ -271,18 +275,22 @@
-
line diff
+
-
     1.1 --- a/b	Thu Jan 01 00:00:00 1970 +0000
-       1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
-       1.3 @@ -1,1 +0,0 @@
-       1.4 -b
-  
+
  1. --- a/b Thu Jan 01 00:00:00 1970 +0000 +
  2. +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 +
  3. @@ -1,1 +0,0 @@ +
  4. -b +
- + @@ -403,24 +411,28 @@
-
line diff
+
-
     1.1 new file mode 100644
-       1.2 --- /dev/null
-       1.3 +++ b/a
-       1.4 @@ -0,0 +1,1 @@
-       1.5 +a
-  
     2.1 new file mode 100644
-       2.2 --- /dev/null
-       2.3 +++ b/b
-       2.4 @@ -0,0 +1,1 @@
-       2.5 +b
-  
+
  1. new file mode 100644 +
  2. --- /dev/null +
  3. +++ b/a +
  4. @@ -0,0 +1,1 @@ +
  5. +a +
  1. new file mode 100644 +
  2. --- /dev/null +
  3. +++ b/b +
  4. @@ -0,0 +1,1 @@ +
  5. +b +
- + @@ -536,16 +548,20 @@
-
line diff
+
-
     1.1 old mode 100644
-       1.2 new mode 100755
-  
+
  1. old mode 100644 +
  2. new mode 100755 +
- + @@ -663,7 +679,11 @@ - + @@ -789,7 +809,11 @@ - + @@ -913,7 +937,11 @@ - + diff -r 746e1cd79784 -r 3dc48ea51541 tests/test-hgweb-empty.t --- a/tests/test-hgweb-empty.t Fri May 31 13:17:59 2013 +0400 +++ b/tests/test-hgweb-empty.t Fri May 31 14:25:40 2013 +0400 @@ -91,7 +91,11 @@ - + @@ -184,7 +188,11 @@ - + @@ -328,7 +336,11 @@ - + @@ -401,7 +413,11 @@ - + diff -r 746e1cd79784 -r 3dc48ea51541 tests/test-hgweb-filelog.t --- a/tests/test-hgweb-filelog.t Fri May 31 13:17:59 2013 +0400 +++ b/tests/test-hgweb-filelog.t Fri May 31 14:25:40 2013 +0400 @@ -207,7 +207,11 @@ - + @@ -314,7 +318,11 @@ - + @@ -416,7 +424,11 @@ - + @@ -518,7 +530,11 @@ - + @@ -583,7 +599,11 @@ - + diff -r 746e1cd79784 -r 3dc48ea51541 tests/test-hgweb-removed.t --- a/tests/test-hgweb-removed.t Fri May 31 13:17:59 2013 +0400 +++ b/tests/test-hgweb-removed.t Fri May 31 14:25:40 2013 +0400 @@ -115,18 +115,22 @@
-
line diff
+
-
     1.1 --- a/a	Thu Jan 01 00:00:00 1970 +0000
-       1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
-       1.3 @@ -1,1 +0,0 @@
-       1.4 -a
-  
+
  1. --- a/a Thu Jan 01 00:00:00 1970 +0000 +
  2. +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 +
  3. @@ -1,1 +0,0 @@ +
  4. -a +
- + @@ -215,18 +219,22 @@
-
line diff
+
-
     1.1 --- a/a	Thu Jan 01 00:00:00 1970 +0000
-       1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
-       1.3 @@ -1,1 +0,0 @@
-       1.4 -a
-  
+
  1. --- a/a Thu Jan 01 00:00:00 1970 +0000 +
  2. +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 +
  3. @@ -1,1 +0,0 @@ +
  4. -a +
- + diff -r 746e1cd79784 -r 3dc48ea51541 tests/test-hgweb.t --- a/tests/test-hgweb.t Fri May 31 13:17:59 2013 +0400 +++ b/tests/test-hgweb.t Fri May 31 14:25:40 2013 +0400 @@ -96,7 +96,11 @@ - + @@ -186,7 +190,11 @@ - + @@ -290,7 +298,11 @@ - + diff -r 746e1cd79784 -r 3dc48ea51541 tests/test-hgwebdir.t --- a/tests/test-hgwebdir.t Fri May 31 13:17:59 2013 +0400 +++ b/tests/test-hgwebdir.t Fri May 31 14:25:40 2013 +0400 @@ -655,7 +655,11 @@ - + @@ -722,7 +726,11 @@ - + @@ -1082,7 +1090,11 @@ - + diff -r 746e1cd79784 -r 3dc48ea51541 tests/test-highlight.t --- a/tests/test-highlight.t Fri May 31 13:17:59 2013 +0400 +++ b/tests/test-highlight.t Fri May 31 14:25:40 2013 +0400 @@ -136,46 +136,52 @@
-
line source
+
+
    -
    1 #!/usr/bin/env python
    - -
    3 """Fun with generators. Corresponding Haskell implementation:
    - -
    5 primes = 2 : sieve [3, 5..]
    -
    6 where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
    -
    7 """
    - -
    9 from itertools import dropwhile, ifilter, islice, count, chain
    - -
    11 def primes():
    -
    12 """Generate all primes."""
    -
    13 def sieve(ns):
    -
    14 p = ns.next()
    -
    15 # It is important to yield *here* in order to stop the
    -
    16 # infinite recursion.
    -
    17 yield p
    -
    18 ns = ifilter(lambda n: n % p != 0, ns)
    -
    19 for n in sieve(ns):
    -
    20 yield n
    - -
    22 odds = ifilter(lambda i: i % 2 == 1, count())
    -
    23 return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
    - -
    25 if __name__ == "__main__":
    -
    26 import sys
    -
    27 try:
    -
    28 n = int(sys.argv[1])
    -
    29 except (ValueError, IndexError):
    -
    30 n = 10
    -
    31 p = primes()
    -
    32 print "The first %d primes: %s" % (n, list(islice(p, n)))
    +
  1. #!/usr/bin/env python
  2. +
  3. +
  4. """Fun with generators. Corresponding Haskell implementation:
  5. +
  6. +
  7. primes = 2 : sieve [3, 5..]
  8. +
  9. where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
  10. +
  11. """
  12. +
  13. +
  14. from itertools import dropwhile, ifilter, islice, count, chain
  15. +
  16. +
  17. def primes():
  18. +
  19. """Generate all primes."""
  20. +
  21. def sieve(ns):
  22. +
  23. p = ns.next()
  24. +
  25. # It is important to yield *here* in order to stop the
  26. +
  27. # infinite recursion.
  28. +
  29. yield p
  30. +
  31. ns = ifilter(lambda n: n % p != 0, ns)
  32. +
  33. for n in sieve(ns):
  34. +
  35. yield n
  36. +
  37. +
  38. odds = ifilter(lambda i: i % 2 == 1, count())
  39. +
  40. return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
  41. +
  42. +
  43. if __name__ == "__main__":
  44. +
  45. import sys
  46. +
  47. try:
  48. +
  49. n = int(sys.argv[1])
  50. +
  51. except (ValueError, IndexError):
  52. +
  53. n = 10
  54. +
  55. p = primes()
  56. +
  57. print "The first %d primes: %s" % (n, list(islice(p, n)))
  58. +
- + @@ -502,7 +508,11 @@ - + @@ -586,24 +596,24 @@ > > echo % hgweb filerevision, html > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "file/tip/$2" \ - > | grep '
' + > | grep '
  • ' > echo % errors encountered > cat errors.log > } $ hgserveget euc-jp eucjp.txt % HGENCODING=euc-jp hg serve % hgweb filerevision, html -
    1 \xb5\xfe
    (esc) +
  • \xb5\xfe
  • (esc) % errors encountered $ hgserveget utf-8 eucjp.txt % HGENCODING=utf-8 hg serve % hgweb filerevision, html -
    1 \xef\xbf\xbd\xef\xbf\xbd
    (esc) +
  • \xef\xbf\xbd\xef\xbf\xbd
  • (esc) % errors encountered $ hgserveget us-ascii eucjp.txt % HGENCODING=us-ascii hg serve % hgweb filerevision, html -
    1 ??
    +
  • ??
  • % errors encountered $ cd ..