1/**
2 * Copyright (c) Glow Contributors. See CONTRIBUTORS file.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "glow/Testing/StrCheck.h"
18#include "gtest/gtest.h"
19
20using glow::StrCheck;
21
22TEST(StrCheck, check) {
23 EXPECT_TRUE(StrCheck("foo bar").check("oo").check("bar"));
24 EXPECT_FALSE(StrCheck("foo bar").check("foo").check("oo"));
25}
26
27TEST(StrCheck, sameln) {
28 EXPECT_TRUE(StrCheck("foo bar").sameln("foo").sameln("bar"));
29 EXPECT_FALSE(StrCheck("foo\nbar").sameln("foo").sameln("bar"));
30}
31
32TEST(StrCheck, nextln) {
33 EXPECT_FALSE(StrCheck("foo bar").check("foo").nextln("bar"));
34 EXPECT_TRUE(StrCheck("foo\nbar").check("foo").nextln("bar"));
35 EXPECT_FALSE(StrCheck("foo\n\nbar").check("foo").nextln("bar"));
36}
37
38TEST(StrCheck, no) {
39 EXPECT_TRUE(StrCheck("foo bar").check("foo").no("baz"));
40 EXPECT_FALSE(StrCheck("foo bar").check("foo").no("bar"));
41 EXPECT_TRUE(StrCheck("foo bar").no("baz").check("bar"));
42 EXPECT_FALSE(StrCheck("foo bar").no("foo").check("bar"));
43 EXPECT_TRUE(StrCheck("foo bar").check("foo").no("o"));
44
45 EXPECT_FALSE(StrCheck("foo bar\nbaz").check("foo").no("bar").nextln("baz"));
46}
47