view tests/test-bdiff @ 488:77c66c4eec0e

[PATCH] Set locale before run-tests does anything -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] Set locale before run-tests does anything From: Bryan O'Sullivan <bos@serpentine.com> On Mon, 2005-06-27 at 11:58 -0700, Bryan O'Sullivan wrote: > I'm in en_us.UTF-8. This discrepancy between my locale and Matt's broke several tests for me, by the way. I think that the run-tests script should forcibly set the locale to either "C" or "en_us.UTF-8" before it runs anything. Since "C" is likely to be more portable, it's probably the right choice. Here's the patch. manifest hash: 1bf3291eafbde0cdeb1222bb72295c0e2974f236 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCwOyVywK+sNU5EO8RAk18AJ4pYmvvJMZfFIR39NqvquXhhWPUTQCcDhhg Ce12AHU8o+m/aFToyRaaQL8= =5nRs -----END PGP SIGNATURE-----
author mpm@selenic.com
date Mon, 27 Jun 2005 22:22:13 -0800
parents 8b067bde6679
children ec85f9e6f3b1 8f5637f0a0c0 0902ffece4b4
line wrap: on
line source

#!/usr/bin/env python

import sys
from mercurial import bdiff, mpatch

def test1(a, b):
    d = bdiff.bdiff(a, b)
    c = a
    if d:
        c = mpatch.patches(a, [d])
    if c != b:
        print "***", `a`, `b`
        print "bad:"
        print `c`[:200]
        print `d`

def test(a, b):
    print "***", `a`, `b`
    test1(a, b)
    test1(b, a)

test("a\nc\n\n\n\n", "a\nb\n\n\n")
test("a\nb\nc\n", "a\nc\n")
test("", "")
test("a\nb\nc", "a\nb\nc")
test("a\nb\nc\nd\n", "a\nd\n")
test("a\nb\nc\nd\n", "a\nc\ne\n")
test("a\nb\nc\n", "a\nc\n")
test("a\n", "c\na\nb\n")
test("a\n", "")
test("a\n", "b\nc\n")
test("a\n", "c\na\n")
test("", "adjfkjdjksdhfksj")
test("", "ab")
test("", "abc")
test("a", "a")
test("ab", "ab")
test("abc", "abc")
test("a\n", "a\n")
test("a\nb", "a\nb")

print "done"