From 92e256d74f33d523033bd17c7d96411cf9391e2e Mon Sep 17 00:00:00 2001 From: Matt Mackall Date: Sun, 26 Sep 2010 13:43:21 -0500 Subject: [PATCH] tests: unify test-mactext --- tests/test-mactext | 32 -------------------------------- tests/test-mactext.out | 12 ------------ tests/test-mactext.t | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 44 deletions(-) delete mode 100755 tests/test-mactext delete mode 100644 tests/test-mactext.out create mode 100644 tests/test-mactext.t diff --git a/tests/test-mactext b/tests/test-mactext deleted file mode 100755 index 2a04f375ea..0000000000 --- a/tests/test-mactext +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -cat > unix2mac.py < print.py <').replace('\r', '').replace('\0', '')) -EOF - -hg init -echo '[hooks]' >> .hg/hgrc -echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc -echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc -cat .hg/hgrc -echo - -echo hello > f -hg add f -hg ci -m 1 -echo - -python unix2mac.py f -hg ci -m 2 -hg cat f | python print.py -cat f | python print.py diff --git a/tests/test-mactext.out b/tests/test-mactext.out deleted file mode 100644 index 161138cbe7..0000000000 --- a/tests/test-mactext.out +++ /dev/null @@ -1,12 +0,0 @@ -[hooks] -pretxncommit.cr = python:hgext.win32text.forbidcr -pretxnchangegroup.cr = python:hgext.win32text.forbidcr - - -Attempt to commit or push text file(s) using CR line endings -in dea860dc51ec: f -transaction abort! -rollback completed -abort: pretxncommit.cr hook failed -hello -hello diff --git a/tests/test-mactext.t b/tests/test-mactext.t new file mode 100644 index 0000000000..3df5db5c63 --- /dev/null +++ b/tests/test-mactext.t @@ -0,0 +1,40 @@ + + $ cat > unix2mac.py < import sys + > + > for path in sys.argv[1:]: + > data = file(path, 'rb').read() + > data = data.replace('\n', '\r') + > file(path, 'wb').write(data) + > EOF + $ cat > print.py < import sys + > print(sys.stdin.read().replace('\n', '').replace('\r', '').replace('\0', '')) + > EOF + $ hg init + $ echo '[hooks]' >> .hg/hgrc + $ echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc + $ echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc + $ cat .hg/hgrc + [hooks] + pretxncommit.cr = python:hgext.win32text.forbidcr + pretxnchangegroup.cr = python:hgext.win32text.forbidcr + $ echo + + $ echo hello > f + $ hg add f + $ hg ci -m 1 + $ echo + + $ python unix2mac.py f + $ hg ci -m 2 + Attempt to commit or push text file(s) using CR line endings + in dea860dc51ec: f + transaction abort! + rollback completed + abort: pretxncommit.cr hook failed + [255] + $ hg cat f | python print.py + hello + $ cat f | python print.py + hello