proxygen
LibgenTest.cpp File Reference
#include <string>
#include <folly/portability/GTest.h>
#include <folly/portability/Libgen.h>

Go to the source code of this file.

Functions

 TEST (Libgen, dirname)
 

Function Documentation

TEST ( Libgen  ,
dirname   
)

Definition at line 22 of file LibgenTest.cpp.

References EXPECT_EQ, bm::free(), folly::portability::internal_dirname(), and string.

22  {
23  auto doDirname = [](const char* str) -> std::string {
24  auto tmp = strdup(str); // we need a mutable string for dirname.
26  free(tmp);
27  return ret;
28  };
29  EXPECT_EQ("/usr", doDirname("/usr/lib"));
30  EXPECT_EQ("/", doDirname("/usr/"));
31  EXPECT_EQ(".", doDirname("usr"));
32  EXPECT_EQ("/", doDirname("/"));
33  EXPECT_EQ(".", doDirname("."));
34  EXPECT_EQ(".", doDirname(".."));
35 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
void free()
char * internal_dirname(char *path)
Definition: Libgen.cpp:24
const char * string
Definition: Conv.cpp:212