From 46bc43acc4f88369054a4de94782086a5fd57ba2 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 6 Mar 2018 21:48:36 +0100 Subject: [PATCH] Add unit test for IsWindowsAbsolutePath and remove explitic true/false checks (! instead) --- src/project.cc | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/project.cc b/src/project.cc index 5ff75420..2b96ffc8 100644 --- a/src/project.cc +++ b/src/project.cc @@ -1482,19 +1482,20 @@ TEST_SUITE("Project") { } TEST_CASE("IsWindowsAbsolutePath works correctly") { - REQUIRE(IsWindowsAbsolutePath("C:/Users/projects/") == true); - REQUIRE(IsWindowsAbsolutePath("C:/Users/projects") == true); - REQUIRE(IsWindowsAbsolutePath("C:/Users/projects") == true); - REQUIRE(IsWindowsAbsolutePath("C:\\Users\\projects") == true); - REQUIRE(IsWindowsAbsolutePath("C:\\\\Users\\\\projects") == true); - REQUIRE(IsWindowsAbsolutePath("c:\\\\Users\\\\projects") == true); - REQUIRE(IsWindowsAbsolutePath("A:\\\\Users\\\\projects") == true); + REQUIRE(IsWindowsAbsolutePath("C:/Users/projects/")); + REQUIRE(IsWindowsAbsolutePath("C:/Users/projects")); + REQUIRE(IsWindowsAbsolutePath("C:/Users/projects")); + REQUIRE(IsWindowsAbsolutePath("C:\\Users\\projects")); + REQUIRE(IsWindowsAbsolutePath("C:\\\\Users\\\\projects")); + REQUIRE(IsWindowsAbsolutePath("c:\\\\Users\\\\projects")); + REQUIRE(IsWindowsAbsolutePath("A:\\\\Users\\\\projects")); - REQUIRE(IsWindowsAbsolutePath("C:/") == false); - REQUIRE(IsWindowsAbsolutePath("../abc/test") == false); - REQUIRE(IsWindowsAbsolutePath("5:/test") == false); - REQUIRE(IsWindowsAbsolutePath("cquery/project/file.cc") == false); - REQUIRE(IsWindowsAbsolutePath("") == false); + REQUIRE(!IsWindowsAbsolutePath("C:/")); + REQUIRE(!IsWindowsAbsolutePath("../abc/test")); + REQUIRE(!IsWindowsAbsolutePath("5:/test")); + REQUIRE(!IsWindowsAbsolutePath("cquery/project/file.cc")); + REQUIRE(!IsWindowsAbsolutePath("")); + REQUIRE(!IsWindowsAbsolutePath("/etc/linux/path")); } TEST_CASE("Entry inference prefers same file endings") {