From 7e3ddf47b5ee1d136e357d1203b007899718d4a4 Mon Sep 17 00:00:00 2001 From: Matt Mackall Date: Sun, 26 Sep 2010 13:44:49 -0500 Subject: [PATCH] tests: unify test-simplemerge-cmd --- tests/test-simplemerge-cmd | 61 ------------ tests/test-simplemerge-cmd.out | 109 --------------------- tests/test-simplemerge-cmd.t | 172 +++++++++++++++++++++++++++++++++ 3 files changed, 172 insertions(+), 170 deletions(-) delete mode 100755 tests/test-simplemerge-cmd delete mode 100644 tests/test-simplemerge-cmd.out create mode 100644 tests/test-simplemerge-cmd.t diff --git a/tests/test-simplemerge-cmd b/tests/test-simplemerge-cmd deleted file mode 100755 index f30e7d7583..0000000000 --- a/tests/test-simplemerge-cmd +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -cp "$TESTDIR"/../contrib/simplemerge . - -echo base > base - -echo local > local -cat base >> local -cp local orig - -cat base > other -echo other >> other - -echo '% changing local directly' -python simplemerge local base other && echo "merge succeeded" -cat local -cp orig local - -echo '% printing to stdout' -python simplemerge -p local base other -echo ' local:' -cat local - -echo '% conflicts' -cp base conflict-local -cp other conflict-other -echo not other >> conflict-local -echo end >> conflict-local -echo end >> conflict-other -python simplemerge -p conflict-local base conflict-other || echo "merge failed" - -echo '% --no-minimal' -python simplemerge -p --no-minimal conflict-local base conflict-other - -echo '% 1 label' -python simplemerge -p -L foo conflict-local base conflict-other - -echo '% 2 labels' -python simplemerge -p -L foo -L bar conflict-local base conflict-other - -echo '% too many labels' -python simplemerge -p -L foo -L bar -L baz conflict-local base conflict-other - -echo '% binary file' -python -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()" -cat orig >> binary-local -python simplemerge -p binary-local base other - -echo '% binary file --text' -python simplemerge -a -p binary-local base other 2>&1 | $TESTDIR/printrepr.py - -echo '% help' -python simplemerge --help - -echo '% wrong number of arguments' -python simplemerge - -echo '% bad option' -python simplemerge --foo -p local base other - -exit 0 diff --git a/tests/test-simplemerge-cmd.out b/tests/test-simplemerge-cmd.out deleted file mode 100644 index 7eab44e2fc..0000000000 --- a/tests/test-simplemerge-cmd.out +++ /dev/null @@ -1,109 +0,0 @@ -% changing local directly -merge succeeded -local -base -other -% printing to stdout -local -base -other - local: -local -base -% conflicts -base -<<<<<<< conflict-local -not other -======= -other ->>>>>>> conflict-other -end -warning: conflicts during merge. -merge failed -% --no-minimal -base -<<<<<<< conflict-local -not other -end -======= -other -end ->>>>>>> conflict-other -warning: conflicts during merge. -% 1 label -base -<<<<<<< foo -not other -======= -other ->>>>>>> conflict-other -end -warning: conflicts during merge. -% 2 labels -base -<<<<<<< foo -not other -======= -other ->>>>>>> bar -end -warning: conflicts during merge. -% too many labels -abort: can only specify two labels. -% binary file -abort: binary-local looks like a binary file. -% binary file --text -warning: binary-local looks like a binary file. -\x00local -base -other -% help -simplemerge [OPTS] LOCAL BASE OTHER - - Simple three-way file merge utility with a minimal feature set. - - Apply to LOCAL the changes necessary to go from BASE to OTHER. - - By default, LOCAL is overwritten with the results of this operation. - -options: - -L --label labels to use on conflict markers - -a --text treat all files as text - -p --print print results instead of overwriting LOCAL - --no-minimal do not try to minimize conflict regions - -h --help display help and exit - -q --quiet suppress output -% wrong number of arguments -simplemerge: wrong number of arguments -simplemerge [OPTS] LOCAL BASE OTHER - - Simple three-way file merge utility with a minimal feature set. - - Apply to LOCAL the changes necessary to go from BASE to OTHER. - - By default, LOCAL is overwritten with the results of this operation. - -options: - -L --label labels to use on conflict markers - -a --text treat all files as text - -p --print print results instead of overwriting LOCAL - --no-minimal do not try to minimize conflict regions - -h --help display help and exit - -q --quiet suppress output -% bad option -simplemerge: option --foo not recognized -simplemerge [OPTS] LOCAL BASE OTHER - - Simple three-way file merge utility with a minimal feature set. - - Apply to LOCAL the changes necessary to go from BASE to OTHER. - - By default, LOCAL is overwritten with the results of this operation. - -options: - -L --label labels to use on conflict markers - -a --text treat all files as text - -p --print print results instead of overwriting LOCAL - --no-minimal do not try to minimize conflict regions - -h --help display help and exit - -q --quiet suppress output diff --git a/tests/test-simplemerge-cmd.t b/tests/test-simplemerge-cmd.t new file mode 100644 index 0000000000..b81a56f18b --- /dev/null +++ b/tests/test-simplemerge-cmd.t @@ -0,0 +1,172 @@ + + $ cp "$TESTDIR"/../contrib/simplemerge . + $ echo base > base + $ echo local > local + $ cat base >> local + $ cp local orig + $ cat base > other + $ echo other >> other + +changing local directly + + $ python simplemerge local base other && echo "merge succeeded" + merge succeeded + $ cat local + local + base + other + $ cp orig local + +printing to stdout + + $ python simplemerge -p local base other + local + base + other + +local: + + $ cat local + local + base + +conflicts + + $ cp base conflict-local + $ cp other conflict-other + $ echo not other >> conflict-local + $ echo end >> conflict-local + $ echo end >> conflict-other + $ python simplemerge -p conflict-local base conflict-other + base + <<<<<<< conflict-local + not other + ======= + other + >>>>>>> conflict-other + end + warning: conflicts during merge. + [1] + +--no-minimal + + $ python simplemerge -p --no-minimal conflict-local base conflict-other + base + <<<<<<< conflict-local + not other + end + ======= + other + end + >>>>>>> conflict-other + warning: conflicts during merge. + [1] + +1 label + + $ python simplemerge -p -L foo conflict-local base conflict-other + base + <<<<<<< foo + not other + ======= + other + >>>>>>> conflict-other + end + warning: conflicts during merge. + [1] + +2 labels + + $ python simplemerge -p -L foo -L bar conflict-local base conflict-other + base + <<<<<<< foo + not other + ======= + other + >>>>>>> bar + end + warning: conflicts during merge. + [1] + +too many labels + + $ python simplemerge -p -L foo -L bar -L baz conflict-local base conflict-other + abort: can only specify two labels. + [255] + +binary file + + $ python -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()" + $ cat orig >> binary-local + $ python simplemerge -p binary-local base other + abort: binary-local looks like a binary file. + [255] + +binary file --text + + $ python simplemerge -a -p binary-local base other 2>&1 | $TESTDIR/printrepr.py + warning: binary-local looks like a binary file. + \x00local + base + other + +help + + $ python simplemerge --help + simplemerge [OPTS] LOCAL BASE OTHER + + Simple three-way file merge utility with a minimal feature set. + + Apply to LOCAL the changes necessary to go from BASE to OTHER. + + By default, LOCAL is overwritten with the results of this operation. + + options: + -L --label labels to use on conflict markers + -a --text treat all files as text + -p --print print results instead of overwriting LOCAL + --no-minimal do not try to minimize conflict regions + -h --help display help and exit + -q --quiet suppress output + +wrong number of arguments + + $ python simplemerge + simplemerge: wrong number of arguments + simplemerge [OPTS] LOCAL BASE OTHER + + Simple three-way file merge utility with a minimal feature set. + + Apply to LOCAL the changes necessary to go from BASE to OTHER. + + By default, LOCAL is overwritten with the results of this operation. + + options: + -L --label labels to use on conflict markers + -a --text treat all files as text + -p --print print results instead of overwriting LOCAL + --no-minimal do not try to minimize conflict regions + -h --help display help and exit + -q --quiet suppress output + [1] + +bad option + + $ python simplemerge --foo -p local base other + simplemerge: option --foo not recognized + simplemerge [OPTS] LOCAL BASE OTHER + + Simple three-way file merge utility with a minimal feature set. + + Apply to LOCAL the changes necessary to go from BASE to OTHER. + + By default, LOCAL is overwritten with the results of this operation. + + options: + -L --label labels to use on conflict markers + -a --text treat all files as text + -p --print print results instead of overwriting LOCAL + --no-minimal do not try to minimize conflict regions + -h --help display help and exit + -q --quiet suppress output + [1]