Movatterモバイル変換


[0]ホーム

URL:


Google Git
Sign in
chromium /chromium /src /refs/heads/main /. /dbus /string_util_unittest.cc
blob: cc6296461c0bc495cc461f18ea7f909e4b58bb73 [file] [log] [blame]
Avi Drissmanf75e37f2022-09-13 19:40:31[diff] [blame]1// Copyright 2012 The Chromium Authors
hashimoto@chromium.org43fa5b82012-06-05 04:15:50[diff] [blame]2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include"dbus/string_util.h"
6#include"testing/gtest/include/gtest/gtest.h"
7
thestig@chromium.org2a57ca642013-06-13 06:37:19[diff] [blame]8namespace dbus{
9
hashimoto@chromium.org43fa5b82012-06-05 04:15:50[diff] [blame]10TEST(StringUtilTest,IsValidObjectPath){
thestig@chromium.org2a57ca642013-06-13 06:37:19[diff] [blame]11 EXPECT_TRUE(IsValidObjectPath("/"));
12 EXPECT_TRUE(IsValidObjectPath("/foo/bar"));
13 EXPECT_TRUE(IsValidObjectPath("/hoge_fuga/piyo123"));
hashimoto@chromium.org43fa5b82012-06-05 04:15:50[diff] [blame]14// Empty string.
thestig@chromium.org2a57ca642013-06-13 06:37:19[diff] [blame]15 EXPECT_FALSE(IsValidObjectPath(std::string()));
16// Empty element.
17 EXPECT_FALSE(IsValidObjectPath("//"));
18 EXPECT_FALSE(IsValidObjectPath("/foo//bar"));
19 EXPECT_FALSE(IsValidObjectPath("/foo///bar"));
hashimoto@chromium.org43fa5b82012-06-05 04:15:50[diff] [blame]20// Trailing '/'.
thestig@chromium.org2a57ca642013-06-13 06:37:19[diff] [blame]21 EXPECT_FALSE(IsValidObjectPath("/foo/"));
22 EXPECT_FALSE(IsValidObjectPath("/foo/bar/"));
hashimoto@chromium.org43fa5b82012-06-05 04:15:50[diff] [blame]23// Not beginning with '/'.
thestig@chromium.org2a57ca642013-06-13 06:37:19[diff] [blame]24 EXPECT_FALSE(IsValidObjectPath("foo/bar"));
hashimoto@chromium.org43fa5b82012-06-05 04:15:50[diff] [blame]25// Invalid characters.
thestig@chromium.org2a57ca642013-06-13 06:37:19[diff] [blame]26 EXPECT_FALSE(IsValidObjectPath("/foo.bar"));
27 EXPECT_FALSE(IsValidObjectPath("/foo/*"));
28 EXPECT_FALSE(IsValidObjectPath("/foo/bar(1)"));
hashimoto@chromium.org43fa5b82012-06-05 04:15:50[diff] [blame]29}
thestig@chromium.org2a57ca642013-06-13 06:37:19[diff] [blame]30
31}// namespace dbus

[8]ページ先頭

©2009-2025 Movatter.jp