René Scharfe | b4285c7 | 2009-01-17 16:50:13 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='check that the most basic functions work |
| 4 | |
| 5 | |
| 6 | Verify wrappers and compatibility functions. |
| 7 | ' |
| 8 | |
| 9 | . ./test-lib.sh |
| 10 | |
| 11 | test_expect_success 'character classes (isspace, isalpha etc.)' ' |
Nguyễn Thái Ngọc Duy | e499894 | 2018-03-24 08:44:35 +0100 | [diff] [blame] | 12 | test-tool ctype |
René Scharfe | b4285c7 | 2009-01-17 16:50:13 +0100 | [diff] [blame] | 13 | ' |
| 14 | |
Arnout Engelen | 6cf6bb3 | 2010-12-18 22:28:00 +0100 | [diff] [blame] | 15 | test_expect_success 'mktemp to nonexistent directory prints filename' ' |
Nguyễn Thái Ngọc Duy | d9cc2c8 | 2018-03-24 08:44:47 +0100 | [diff] [blame] | 16 | test_must_fail test-tool mktemp doesnotexist/testXXXXXX 2>err && |
Arnout Engelen | 6cf6bb3 | 2010-12-18 22:28:00 +0100 | [diff] [blame] | 17 | grep "doesnotexist/test" err |
| 18 | ' |
| 19 | |
Torsten Bögershausen | b3b8ceb | 2013-06-08 14:17:49 +0200 | [diff] [blame] | 20 | test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints filename' ' |
Arnout Engelen | 6cf6bb3 | 2010-12-18 22:28:00 +0100 | [diff] [blame] | 21 | mkdir cannotwrite && |
Arnout Engelen | 6cf6bb3 | 2010-12-18 22:28:00 +0100 | [diff] [blame] | 22 | test_when_finished "chmod +w cannotwrite" && |
Junio C Hamano | 0377142 | 2018-06-15 11:13:39 -0700 | [diff] [blame] | 23 | chmod -w cannotwrite && |
Nguyễn Thái Ngọc Duy | d9cc2c8 | 2018-03-24 08:44:47 +0100 | [diff] [blame] | 24 | test_must_fail test-tool mktemp cannotwrite/testXXXXXX 2>err && |
Arnout Engelen | 6cf6bb3 | 2010-12-18 22:28:00 +0100 | [diff] [blame] | 25 | grep "cannotwrite/test" err |
| 26 | ' |
| 27 | |
Dale R. Worley | 253b27f | 2013-08-02 20:27:23 -0400 | [diff] [blame] | 28 | test_expect_success 'git_mkstemps_mode does not fail if fd 0 is not open' ' |
| 29 | git commit --allow-empty -m message <&- |
| 30 | ' |
| 31 | |
Ramsay Jones | c918415 | 2012-09-01 18:46:54 +0100 | [diff] [blame] | 32 | test_expect_success 'check for a bug in the regex routines' ' |
| 33 | # if this test fails, re-build git with NO_REGEX=1 |
Nguyễn Thái Ngọc Duy | 9038531 | 2018-03-24 08:44:53 +0100 | [diff] [blame] | 34 | test-tool regex --bug |
Ramsay Jones | c918415 | 2012-09-01 18:46:54 +0100 | [diff] [blame] | 35 | ' |
| 36 | |
Johannes Schindelin | 17e7dbb | 2020-10-19 19:35:40 +0000 | [diff] [blame] | 37 | test_expect_success 'incomplete sideband messages are reassembled' ' |
| 38 | test-tool pkt-line send-split-sideband >split-sideband && |
| 39 | test-tool pkt-line receive-sideband <split-sideband 2>err && |
| 40 | grep "Hello, world" err |
| 41 | ' |
| 42 | |
Jeff King | af22a63 | 2020-10-28 05:33:24 -0400 | [diff] [blame] | 43 | test_expect_success 'eof on sideband message is reported' ' |
| 44 | printf 1234 >input && |
| 45 | test-tool pkt-line receive-sideband <input 2>err && |
| 46 | test_i18ngrep "unexpected disconnect" err |
| 47 | ' |
| 48 | |
| 49 | test_expect_success 'missing sideband designator is reported' ' |
| 50 | printf 0004 >input && |
| 51 | test-tool pkt-line receive-sideband <input 2>err && |
| 52 | test_i18ngrep "missing sideband" err |
| 53 | ' |
| 54 | |
René Scharfe | b4285c7 | 2009-01-17 16:50:13 +0100 | [diff] [blame] | 55 | test_done |