blob: 8d59905ef099bf0ab46d0681568dd17d7ed85d98 [file] [log] [blame]
René Scharfeb4285c72009-01-17 16:50:13 +01001#!/bin/sh
2
3test_description='check that the most basic functions work
4
5
6Verify wrappers and compatibility functions.
7'
8
9. ./test-lib.sh
10
11test_expect_success 'character classes (isspace, isalpha etc.)' '
Nguyễn Thái Ngọc Duye4998942018-03-24 08:44:35 +010012 test-tool ctype
René Scharfeb4285c72009-01-17 16:50:13 +010013'
14
Arnout Engelen6cf6bb32010-12-18 22:28:00 +010015test_expect_success 'mktemp to nonexistent directory prints filename' '
Nguyễn Thái Ngọc Duyd9cc2c82018-03-24 08:44:47 +010016 test_must_fail test-tool mktemp doesnotexist/testXXXXXX 2>err &&
Arnout Engelen6cf6bb32010-12-18 22:28:00 +010017 grep "doesnotexist/test" err
18'
19
Torsten Bögershausenb3b8ceb2013-06-08 14:17:49 +020020test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints filename' '
Arnout Engelen6cf6bb32010-12-18 22:28:00 +010021 mkdir cannotwrite &&
Arnout Engelen6cf6bb32010-12-18 22:28:00 +010022 test_when_finished "chmod +w cannotwrite" &&
Junio C Hamano03771422018-06-15 11:13:39 -070023 chmod -w cannotwrite &&
Nguyễn Thái Ngọc Duyd9cc2c82018-03-24 08:44:47 +010024 test_must_fail test-tool mktemp cannotwrite/testXXXXXX 2>err &&
Arnout Engelen6cf6bb32010-12-18 22:28:00 +010025 grep "cannotwrite/test" err
26'
27
Dale R. Worley253b27f2013-08-02 20:27:23 -040028test_expect_success 'git_mkstemps_mode does not fail if fd 0 is not open' '
29 git commit --allow-empty -m message <&-
30'
31
Ramsay Jonesc9184152012-09-01 18:46:54 +010032test_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 Duy90385312018-03-24 08:44:53 +010034 test-tool regex --bug
Ramsay Jonesc9184152012-09-01 18:46:54 +010035'
36
Johannes Schindelin17e7dbb2020-10-19 19:35:40 +000037test_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 Kingaf22a632020-10-28 05:33:24 -040043test_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
49test_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é Scharfeb4285c72009-01-17 16:50:13 +010055test_done