Flutter Engine
The Flutter Engine
string_conversion_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.
4
5#include "flutter/fml/string_conversion.h"
6
7#include "gtest/gtest.h"
8
9namespace fml {
10namespace testing {
11
12TEST(StringConversion, Utf16ToUtf16Empty) {
13 EXPECT_EQ(Utf8ToUtf16(""), u"");
14}
15
16TEST(StringConversion, Utf8ToUtf16Ascii) {
17 EXPECT_EQ(Utf8ToUtf16("abc123"), u"abc123");
18}
19
20TEST(StringConversion, Utf8ToUtf16Unicode) {
21 EXPECT_EQ(Utf8ToUtf16("\xe2\x98\x83"), u"\x2603");
22}
23
24TEST(StringConversion, Utf16ToUtf8Empty) {
25 EXPECT_EQ(Utf16ToUtf8(u""), "");
26}
27
28TEST(StringConversion, Utf16ToUtf8Ascii) {
29 EXPECT_EQ(Utf16ToUtf8(u"abc123"), "abc123");
30}
31
32TEST(StringConversion, Utf16ToUtf8Unicode) {
33 EXPECT_EQ(Utf16ToUtf8(u"\x2603"), "\xe2\x98\x83");
34}
35
36} // namespace testing
37} // namespace fml
TEST(BacktraceTest, CanGatherBacktrace)
Definition: ascii_trie.cc:9
std::string Utf16ToUtf8(const std::u16string_view string)
std::u16string Utf8ToUtf16(const std::string_view string)