comparison tests/test-annotate.t @ 36697:9a08f7d18c20 stable

test-annotate: rewrite sed with some python I hope this will fix the test failure seen on FreeBSD and Windows.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 04 Mar 2018 13:19:05 -0500
parents 0a7c59a4c835
children 52b344e977b7
comparison
equal deleted inserted replaced
36689:b394778b1a50 36697:9a08f7d18c20
899 ------------------------------------- 899 -------------------------------------
900 900
901 $ hg init repo-cr 901 $ hg init repo-cr
902 $ cd repo-cr 902 $ cd repo-cr
903 903
904 $ substcr() { 904 $ cat <<'EOF' >> "$TESTTMP/substcr.py"
905 > sed 's/\r/[CR]/g' 905 > import sys
906 > } 906 > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
907 > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
908 > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
909 > EOF
907 910
908 >>> with open('a', 'wb') as f: 911 >>> with open('a', 'wb') as f:
909 ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g') 912 ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g')
910 $ hg ci -qAm0 913 $ hg ci -qAm0
911 >>> with open('a', 'wb') as f: 914 >>> with open('a', 'wb') as f:
912 ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g') 915 ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g')
913 $ hg ci -m1 916 $ hg ci -m1
914 917
915 $ hg annotate -r0 a | substcr 918 $ hg annotate -r0 a | $PYTHON "$TESTTMP/substcr.py"
916 0: 0a[CR]0b[CR] 919 0: 0a[CR]0b[CR]
917 0: 0c[CR]0d[CR] 920 0: 0c[CR]0d[CR]
918 0: 0e 921 0: 0e
919 0: 0f 922 0: 0f
920 0: 0g 923 0: 0g
921 $ hg annotate -r1 a | substcr 924 $ hg annotate -r1 a | $PYTHON "$TESTTMP/substcr.py"
922 0: 0a[CR]0b[CR] 925 0: 0a[CR]0b[CR]
923 1: 1c[CR]1d[CR] 926 1: 1c[CR]1d[CR]
924 0: 0e 927 0: 0e
925 1: 1f 928 1: 1f
926 0: 0g 929 0: 0g