comparison tests/test-patchbomb.t @ 39036:598467614c15

tests: put some Python 3 polish on inline Python invocations A couple of these became inline python sessions because they got more involved, and one of them is super-annoying and writes directly to sys.stdout.buffer because I just couldn't make it work any other way. Differential Revision: https://phab.mercurial-scm.org/D4230
author Augie Fackler <augie@google.com>
date Thu, 09 Aug 2018 20:57:27 -0400
parents 1eb779a86c4e
children ede768cfe83e
comparison
equal deleted inserted replaced
39035:cecb05c371f7 39036:598467614c15
524 ZmEyMDE4YiAtciA5MDlhMDBlMTNlOWQgdXRmCi0tLSAvZGV2L251bGwJVGh1IEphbiAwMSAwMDow 524 ZmEyMDE4YiAtciA5MDlhMDBlMTNlOWQgdXRmCi0tLSAvZGV2L251bGwJVGh1IEphbiAwMSAwMDow
525 MDowMCAxOTcwICswMDAwCisrKyBiL3V0ZglUaHUgSmFuIDAxIDAwOjAwOjA0IDE5NzAgKzAwMDAK 525 MDowMCAxOTcwICswMDAwCisrKyBiL3V0ZglUaHUgSmFuIDAxIDAwOjAwOjA0IDE5NzAgKzAwMDAK
526 QEAgLTAsMCArMSwxIEBACitow7ZtbWEhCg== 526 QEAgLTAsMCArMSwxIEBACitow7ZtbWEhCg==
527 527
528 528
529 $ $PYTHON -c 'print open("mbox").read().split("\n\n")[1].decode("base64")' 529 >>> import base64
530 >>> patch = base64.b64decode(open("mbox").read().split("\n\n")[1])
531 >>> if not isinstance(patch, str):
532 ... import sys
533 ... sys.stdout.flush()
534 ... junk = sys.stdout.buffer.write(patch + b"\n")
535 ... else:
536 ... print(patch)
530 # HG changeset patch 537 # HG changeset patch
531 # User test 538 # User test
532 # Date 4 0 539 # Date 4 0
533 # Thu Jan 01 00:00:04 1970 +0000 540 # Thu Jan 01 00:00:04 1970 +0000
534 # Node ID 909a00e13e9d78b575aeee23dddbada46d5a143f 541 # Node ID 909a00e13e9d78b575aeee23dddbada46d5a143f
549 +h\xc3\xb6mma! (esc) 556 +h\xc3\xb6mma! (esc)
550 557
551 $ rm mbox 558 $ rm mbox
552 559
553 mime encoded mbox (quoted-printable): 560 mime encoded mbox (quoted-printable):
554 $ $PYTHON -c 'fp = open("long", "wb"); fp.write(b"%s\nfoo\n\nbar\n" % ("x" * 1024)); fp.close();' 561 $ $PYTHON -c 'fp = open("long", "wb"); fp.write(b"%s\nfoo\n\nbar\n" % (b"x" * 1024)); fp.close();'
555 $ hg commit -A -d '4 0' -m 'long line' 562 $ hg commit -A -d '4 0' -m 'long line'
556 adding long 563 adding long
557 564
558 no mime encoding for email --test: 565 no mime encoding for email --test:
559 $ hg email --date '1970-1-1 0:4' -f quux -t foo -c bar -r tip -n 566 $ hg email --date '1970-1-1 0:4' -f quux -t foo -c bar -r tip -n
2529 @@ -0,0 +1,1 @@ 2536 @@ -0,0 +1,1 @@
2530 +a 2537 +a
2531 2538
2532 2539
2533 test multi-byte domain parsing: 2540 test multi-byte domain parsing:
2534 $ UUML=`$PYTHON -c 'import sys; sys.stdout.write("\374")'` 2541 >>> with open('toaddress.txt', 'wb') as f:
2542 ... f.write(b'bar@\xfcnicode.com') and None
2535 $ HGENCODING=iso-8859-1 2543 $ HGENCODING=iso-8859-1
2536 $ export HGENCODING 2544 $ export HGENCODING
2537 $ hg email --date '1980-1-1 0:1' -m tmp.mbox -f quux -t "bar@${UUML}nicode.com" -s test -r 0 2545 $ hg email --date '1980-1-1 0:1' -m tmp.mbox -f quux -t "`cat toaddress.txt`" -s test -r 0
2538 this patch series consists of 1 patches. 2546 this patch series consists of 1 patches.
2539 2547
2540 Cc: 2548 Cc:
2541 2549
2542 sending [PATCH] test ... 2550 sending [PATCH] test ...