Denis Vlasenko | cc2965f | 2008-03-25 14:15:39 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # Copyright 2008 by Denys Vlasenko |
| 3 | # Licensed under GPL v2, see file LICENSE for details. |
| 4 | |
| 5 | . testing.sh |
| 6 | |
| 7 | # testing "test name" "options" "expected result" "file input" "stdin" |
| 8 | |
| 9 | testing "patch with old_file == new_file" \ |
| 10 | "patch; echo $?; cat input" \ |
| 11 | "\ |
| 12 | patching file input |
| 13 | 0 |
| 14 | qwe |
| 15 | asd |
| 16 | zxc |
| 17 | " \ |
| 18 | "qwe\nzxc\n" \ |
| 19 | "\ |
| 20 | --- input Jan 01 01:01:01 2000 |
| 21 | +++ input Jan 01 01:01:01 2000 |
| 22 | @@ -1,2 +1,3 @@ |
| 23 | qwe |
| 24 | +asd |
| 25 | zxc |
| 26 | " \ |
| 27 | |
| 28 | testing "patch with nonexistent old_file" \ |
Denis Vlasenko | 08ec67b | 2008-03-26 13:32:30 +0000 | [diff] [blame^] | 29 | "patch; echo $?; cat input" \ |
Denis Vlasenko | cc2965f | 2008-03-25 14:15:39 +0000 | [diff] [blame] | 30 | "\ |
| 31 | patching file input |
| 32 | 0 |
| 33 | qwe |
| 34 | asd |
| 35 | zxc |
| 36 | " \ |
| 37 | "qwe\nzxc\n" \ |
| 38 | "\ |
| 39 | --- input.doesnt_exist Jan 01 01:01:01 2000 |
| 40 | +++ input Jan 01 01:01:01 2000 |
| 41 | @@ -1,2 +1,3 @@ |
| 42 | qwe |
| 43 | +asd |
| 44 | zxc |
| 45 | " \ |
| 46 | |
Denis Vlasenko | 08ec67b | 2008-03-26 13:32:30 +0000 | [diff] [blame^] | 47 | testing "patch -R with nonexistent old_file" \ |
| 48 | "patch -R; echo $?; cat input" \ |
| 49 | "\ |
| 50 | patching file input |
| 51 | 0 |
| 52 | qwe |
| 53 | zxc |
| 54 | " \ |
| 55 | "qwe\nasd\nzxc\n" \ |
| 56 | "\ |
| 57 | --- input.doesnt_exist Jan 01 01:01:01 2000 |
| 58 | +++ input Jan 01 01:01:01 2000 |
| 59 | @@ -1,2 +1,3 @@ |
| 60 | qwe |
| 61 | +asd |
| 62 | zxc |
| 63 | " \ |
| 64 | |
Denis Vlasenko | cc2965f | 2008-03-25 14:15:39 +0000 | [diff] [blame] | 65 | exit $FAILCOUNT |