Skip to content

Commit

Permalink
#102 fix absolute path unit test for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
fdefelici committed Jun 16, 2024
1 parent c87dac0 commit efc31e8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/functs/src/unit/path_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ CLOVE_TEST(ConvertAbsToAbsolutePath) {

CLOVE_TEST(ConvertRelToAbsolutePath) {
char* result = __clove_path_to_absolute("rel/path/file.c");

puts(result);
#ifdef _WIN32
const char* result_without_unit = result + 2; //e.g. c:\abs\path\file.c => \abs\path\file.c
CLOVE_STRING_EQ("\\rel\\path\\file.c", result_without_unit);
CLOVE_IS_TRUE(__clove_string_startswith(result_without_unit, "\\"));
CLOVE_IS_TRUE(__clove_string_endswith(result_without_unit, "\\rel\\path\\file.c"));
#else
CLOVE_IS_TRUE(__clove_string_startswith(result, "/"));
CLOVE_IS_TRUE(__clove_string_endswith(result, "/rel/path/file.c"));
Expand Down

0 comments on commit efc31e8

Please sign in to comment.