tests: unify test-eol-hook
authorMatt Mackall <mpm@selenic.com>
Sun, 26 Sep 2010 13:41:32 -0500
changeset 12423 10c3385fa89e
parent 12422 4263359f7eac
child 12424 1aa7ba33f6a9
tests: unify test-eol-hook
tests/test-eol-hook
tests/test-eol-hook.out
tests/test-eol-hook.t
--- a/tests/test-eol-hook	Sun Sep 26 13:41:32 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#!/bin/sh
-
-cat > $HGRCPATH <<EOF
-[diff]
-git = True
-EOF
-
-hg init main
-cat > main/.hg/hgrc <<EOF
-[extensions]
-eol =
-
-[hooks]
-pretxnchangegroup = python:hgext.eol.hook
-EOF
-
-hg clone main fork
-
-cd fork
-cat > .hgeol <<EOF
-[patterns]
-mixed.txt = BIN
-**.txt = native
-EOF
-
-hg add .hgeol
-hg commit -m 'Commit .hgeol'
-
-printf "first\nsecond\nthird\n" > a.txt
-hg add a.txt
-echo "% hg commit (LF a.txt)"
-hg commit -m 'LF a.txt'
-echo "% hg push"
-hg push ../main
-
-printf "first\r\nsecond\r\nthird\n" > a.txt
-echo "% hg commit (CRLF a.txt)"
-hg commit -m 'CRLF a.txt'
-echo "% hg push"
-hg push ../main
-
-
-echo "% hg commit (LF a.txt)"
-printf "first\nsecond\nthird\n" > a.txt
-hg commit -m 'LF a.txt (fixed)'
-echo "% hg push"
-hg push ../main
--- a/tests/test-eol-hook.out	Sun Sep 26 13:41:32 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-updating to branch default
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% hg commit (LF a.txt)
-% hg push
-pushing to ../main
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 2 files
-% hg commit (CRLF a.txt)
-% hg push
-pushing to ../main
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-error: pretxnchangegroup hook failed: a.txt should not have CRLF line endings
-transaction abort!
-rollback completed
-abort: a.txt should not have CRLF line endings
-% hg commit (LF a.txt)
-% hg push
-pushing to ../main
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 1 files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-eol-hook.t	Sun Sep 26 13:41:32 2010 -0500
@@ -0,0 +1,63 @@
+Test the EOL hook
+
+  $ cat > $HGRCPATH <<EOF
+  > [diff]
+  > git = True
+  > EOF
+  $ hg init main
+  $ cat > main/.hg/hgrc <<EOF
+  > [extensions]
+  > eol =
+  > 
+  > [hooks]
+  > pretxnchangegroup = python:hgext.eol.hook
+  > EOF
+  $ hg clone main fork
+  updating to branch default
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd fork
+
+Create repo
+  $ cat > .hgeol <<EOF
+  > [patterns]
+  > mixed.txt = BIN
+  > **.txt = native
+  > EOF
+  $ hg add .hgeol
+  $ hg commit -m 'Commit .hgeol'
+
+  $ printf "first\nsecond\nthird\n" > a.txt
+  $ hg add a.txt
+  $ hg commit -m 'LF a.txt'
+  $ hg push ../main
+  pushing to ../main
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+
+  $ printf "first\r\nsecond\r\nthird\n" > a.txt
+  $ hg commit -m 'CRLF a.txt'
+  $ hg push ../main
+  pushing to ../main
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  error: pretxnchangegroup hook failed: a.txt should not have CRLF line endings
+  transaction abort!
+  rollback completed
+  abort: a.txt should not have CRLF line endings
+  [255]
+
+  $ printf "first\nsecond\nthird\n" > a.txt
+  $ hg commit -m 'LF a.txt (fixed)'
+  $ hg push ../main
+  pushing to ../main
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files