Commit Graph

16 Commits

Author SHA1 Message Date
Russell Belfer
f63d0ee9fc Move all non-ascii test data to raw hex
This takes all of the characters in core::env and makes them use
hex sequences instead of keeping tricky character data inline in
the test.
2013-01-17 15:47:10 -08:00
Russell Belfer
b8a1ea7cf9 Fix core::env cleanup code
Mark fake home directories that failed to be created, so we won't
try to remove them and have cleanup just use p_rmdir.
2013-01-03 11:04:03 -08:00
Ben Straub
600d8dbf6d Move test cleanup into cleanup functions 2013-01-03 09:10:38 -08:00
Ben Straub
6fef1ab344 Tests should clean up after themselves 2013-01-03 07:47:51 -08:00
Sascha Cunz
9094d30b93 Reset all static variables to NULL in clar's __cleanup
Without this change, any failed assertion in the second (or a later) test
inside a test suite has a chance of double deleting memory, resulting in
a heap corruption. See #1096 for details.

This leaves alone the test cases where we "just" use cl_git_sandbox_init()
and cl_git_sandbox_cleanup(). These methods already take good care to not
double delete a repository.

Fixes #1096
2012-11-23 11:41:56 +01:00
nulltoken
0e95e70a55 env: ensure git_futils_find_xxx() returns ENOTFOUND 2012-11-17 05:41:22 -08:00
Russell Belfer
0d422ec9c2 Fix env variable tests with new Win32 path rules
The new Win32 global path search was not working with the
environment variable tests.  But when I fixed the test, the new
codes use of getenv() was causing more failures (presumably because
of caching on Windows ???).  This fixes the global file lookup to
always go directly to the Win32 API in a predictable way.
2012-10-19 15:40:43 -07:00
Vicent Marti
18217e7e8a test: Don't be so picky with failed lookups
Not found means not found, and the other way around.
2012-10-16 19:37:21 +02:00
Carlos Martín Nieto
cdca82c784 Plug a few leaks 2012-06-20 00:46:34 +02:00
Ben Straub
e272efcb20 Tests: wrap 'getenv' and friends for Win32 tests. 2012-06-08 11:24:37 -07:00
Michael Schubert
dbab04594c tests-clar/core: fix non-null warning
gcc 4.7.0 apparently doesn't see that we won't call setenv with NULL as
second argument.
2012-05-26 14:59:07 +02:00
Russell Belfer
29ef309e2c Make errors for system and global files consistent
The error codes from failed lookups of system and global files
on Windows were not consistent with the codes returned on other
platforms.  This makes the error detection patterns match and
adds a unit test for the various errors.
2012-05-25 09:44:56 -07:00
Russell Belfer
2a99df6909 Fix bugs for status with spaces and reloaded attrs
This fixes two bugs:

* Issue #728 where git_status_file was not working for files
  that contain spaces.  This was caused by reusing the "fnmatch"
  parsing code from ignore and attribute files to interpret the
  "pathspec" that constrained the files to apply the status to.
  In that code, unescaped whitespace was considered terminal to
  the pattern, so a file with internal whitespace was excluded
  from the matched files.  The fix was to add a mode to that code
  that allows spaces and tabs inside patterns.  This mode only
  comes into play when parsing in-memory strings.

* The other issue was undetected, but it was in the recently
  added code to reload gitattributes / gitignores when they were
  changed on disk.  That code was not clearing out the old values
  from the cached file content before reparsing which meant that
  newly added patterns would be read in, but deleted patterns
  would not be removed.  The fix was to clear the vector of
  patterns in a cached file before reparsing the file.
2012-05-24 17:14:56 -07:00
Russell Belfer
9cde607c95 Clean up system file finding tests on Win32 2012-05-24 15:08:55 -07:00
Russell Belfer
9e35d7fd6e Fix bugs in UTF-8 <-> UTF-16 conversion
The function to convert UTF-16 to UTF-8 was only allocating a
buffer of wcslen(utf16str) bytes for the UTF-8 string, but that
is not sufficient if you have multibyte characters, and so when
those occured, the conversion was failing.  This updates the
conversion functions to use the Win APIs to calculate the correct
buffer lengths.

Also fixes a comparison in the unit tests that would fail if
you did not have a particular environment variable set.
2012-05-24 13:44:24 -07:00
Russell Belfer
2305913007 Get user's home dir in UTF-16 clean manner
On Windows, we are having problems with home directories
that have non-ascii characters in them.  This rewrites the
relevant code to fetch environment variables as UTF-16 and
then explicitly map then into UTF-8 for our internal usage.
2012-05-24 12:45:20 -07:00