Flutter Engine
 
Loading...
Searching...
No Matches
filter_unittests.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
5#include "gtest/gtest.h"
6
7#include <sstream>
8
9TEST(FilterTest, Simple) {
10 std::stringstream ss;
11 ss << ".*\\.dart" << std::endl;
12 ss << ".*\\.cc" << std::endl;
13
14 absl::StatusOr<Filter> filter = Filter::Open(ss);
15 ASSERT_TRUE(filter.ok());
16 EXPECT_TRUE(filter->Matches("foo/bar/baz.dart"));
17 EXPECT_TRUE(filter->Matches("foo/bar/baz.cc"));
18 EXPECT_FALSE(filter->Matches("foo/bar/baz.txt"));
19}
20
21TEST(FilterTest, Comments) {
22 std::stringstream ss;
23 ss << ".*\\.dart" << std::endl;
24 ss << "# hello!" << std::endl;
25 ss << ".*\\.cc" << std::endl;
26
27 absl::StatusOr<Filter> filter = Filter::Open(ss);
28 ASSERT_TRUE(filter.ok());
29 EXPECT_TRUE(filter->Matches("foo/bar/baz.dart"));
30 EXPECT_TRUE(filter->Matches("foo/bar/baz.cc"));
31 EXPECT_FALSE(filter->Matches("foo/bar/baz.txt"));
32}
static absl::StatusOr< Filter > Open(std::string_view path)
Definition filter.cc:9
TEST(FilterTest, Simple)