push 014043c4937c940c54cd1214c96e33a3b3c8cf7d
[wine/hacks.git] / dlls / msvcrt / tests / environ.c
blob6175e14af693cee608ac3445707b03afaf4bd60b
1 /*
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"
22 #include <stdlib.h>
24 static const char *a_very_long_env_string =
25 "LIBRARY_PATH="
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/;"
35 "/mingw/lib/;"
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/;"
39 "/mingw/lib/;"
40 "/lib/mingw32/3.4.2/;"
41 "/lib/;"
42 "/usr/lib/mingw32/3.4.2/;"
43 "/usr/lib/";
45 START_TEST(environ)
47 ok( _putenv("cat=") == 0, "_putenv failed on deletion of nonexistent environment variable\n" );
48 ok( _putenv("cat=dog") == 0, "failed setting cat=dog\n" );
49 ok( strcmp(getenv("cat"), "dog") == 0, "getenv did not return 'dog'\n" );
50 ok( _putenv("cat=") == 0, "failed deleting cat\n" );
52 ok( _putenv("=") == -1, "should not accept '=' as input\n" );
53 ok( _putenv("=dog") == -1, "should not accept '=dog' as input\n" );
54 ok( _putenv(a_very_long_env_string) == 0, "_putenv failed for long environment string\n");
56 ok( getenv("nonexistent") == NULL, "getenv should fail with nonexistent var name\n" );