/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
auto it = re.IterCaptureNames();
Maybe<constchar*> result = it.Next();
ASSERT_TRUE(result.isSome());
EXPECT_STREQ(*result, "");
result = it.Next();
ASSERT_TRUE(result.isSome());
EXPECT_STREQ(*result, "year");
result = it.Next();
ASSERT_TRUE(result.isSome());
EXPECT_STREQ(*result, "month");
result = it.Next();
ASSERT_TRUE(result.isSome());
EXPECT_STREQ(*result, "day");
result = it.Next();
ASSERT_TRUE(result.isNothing());
}
/* * This tests whether we can set the flags correctly. In this case, we disable * all flags, which includes disabling Unicode mode. When we disable Unicode * mode, we can match arbitrary possibly invalid UTF-8 bytes, such as \xFF. * (When Unicode mode is enabled, \xFF won't match .)
*/
TEST(TestRustRegex, Flags)
{
{
RustRegex re(".");
ASSERT_TRUE(re);
ASSERT_FALSE(re.IsMatch("\xFF"));
}
{
RustRegex re(".", RustRegexOptions().Unicode(false));
ASSERT_TRUE(re);
ASSERT_TRUE(re.IsMatch("\xFF"));
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.