2 * Unit tests for C library environment routines
4 * Copyright 2004 Mike Hearn <mh@codeweavers.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/test.h"
24 static const char *a_very_long_env_string
=
26 "C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.2/;"
27 "C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/;"
28 "/mingw/lib/gcc/mingw32/3.4.2/;"
29 "/usr/lib/gcc/mingw32/3.4.2/;"
30 "C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.2/../../../../mingw32/lib/mingw32/3.4.2/;"
31 "C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.2/../../../../mingw32/lib/;"
32 "/mingw/mingw32/lib/mingw32/3.4.2/;"
33 "/mingw/mingw32/lib/;"
34 "/mingw/lib/mingw32/3.4.2/;"
36 "C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.2/../../../mingw32/3.4.2/;"
37 "C:/Program Files/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.2/../../../;"
38 "/mingw/lib/mingw32/3.4.2/;"
40 "/lib/mingw32/3.4.2/;"
42 "/usr/lib/mingw32/3.4.2/;"
45 static void test_system(void)
47 int ret
= system(NULL
);
48 ok(ret
== 1, "Expected system to return 1, got %d\n", ret
);
50 ret
= system("echo OK");
51 ok(ret
== 0, "Expected system to return 0, got %d\n", ret
);
56 ok( _putenv("cat=") == 0, "_putenv failed on deletion of nonexistent environment variable\n" );
57 ok( _putenv("cat=dog") == 0, "failed setting cat=dog\n" );
58 ok( strcmp(getenv("cat"), "dog") == 0, "getenv did not return 'dog'\n" );
59 ok( _putenv("cat=") == 0, "failed deleting cat\n" );
61 ok( _putenv("=") == -1, "should not accept '=' as input\n" );
62 ok( _putenv("=dog") == -1, "should not accept '=dog' as input\n" );
63 ok( _putenv(a_very_long_env_string
) == 0, "_putenv failed for long environment string\n");
65 ok( getenv("nonexistent") == NULL
, "getenv should fail with nonexistent var name\n" );