path_util_test.cc
Go to the documentation of this file.
00001 //
00002 //  Copyright 2019 The Abseil Authors.
00003 //
00004 // Licensed under the Apache License, Version 2.0 (the "License");
00005 // you may not use this file except in compliance with the License.
00006 // You may obtain a copy of the License at
00007 //
00008 //      https://www.apache.org/licenses/LICENSE-2.0
00009 //
00010 // Unless required by applicable law or agreed to in writing, software
00011 // distributed under the License is distributed on an "AS IS" BASIS,
00012 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 // See the License for the specific language governing permissions and
00014 // limitations under the License.
00015 
00016 #include "absl/flags/internal/path_util.h"
00017 
00018 #include "gtest/gtest.h"
00019 
00020 namespace {
00021 
00022 namespace flags = absl::flags_internal;
00023 
00024 TEST(FlagsPathUtilTest, TestBasename) {
00025   EXPECT_EQ(flags::Basename(""), "");
00026   EXPECT_EQ(flags::Basename("a.cc"), "a.cc");
00027   EXPECT_EQ(flags::Basename("dir/a.cc"), "a.cc");
00028   EXPECT_EQ(flags::Basename("dir1/dir2/a.cc"), "a.cc");
00029   EXPECT_EQ(flags::Basename("../dir1/dir2/a.cc"), "a.cc");
00030   EXPECT_EQ(flags::Basename("/dir1/dir2/a.cc"), "a.cc");
00031   EXPECT_EQ(flags::Basename("/dir1/dir2/../dir3/a.cc"), "a.cc");
00032 }
00033 
00034 // --------------------------------------------------------------------
00035 
00036 TEST(FlagsPathUtilTest, TestPackage) {
00037   EXPECT_EQ(flags::Package(""), "");
00038   EXPECT_EQ(flags::Package("a.cc"), "");
00039   EXPECT_EQ(flags::Package("dir/a.cc"), "dir/");
00040   EXPECT_EQ(flags::Package("dir1/dir2/a.cc"), "dir1/dir2/");
00041   EXPECT_EQ(flags::Package("../dir1/dir2/a.cc"), "../dir1/dir2/");
00042   EXPECT_EQ(flags::Package("/dir1/dir2/a.cc"), "/dir1/dir2/");
00043   EXPECT_EQ(flags::Package("/dir1/dir2/../dir3/a.cc"), "/dir1/dir2/../dir3/");
00044 }
00045 
00046 }  // namespace


abseil_cpp
Author(s):
autogenerated on Wed Jun 19 2019 19:42:15