|
| 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/command_line.h" |
| 6 | +#include "flutter/fml/file.h" |
| 7 | +#include "flutter/testing/testing.h" |
| 8 | +#include "impeller/compiler/switches.h" |
| 9 | +#include "impeller/compiler/utilities.h" |
| 10 | + |
| 11 | +namespace impeller { |
| 12 | +namespace compiler { |
| 13 | +namespace testing { |
| 14 | + |
| 15 | +TEST(SwitchesTest, DoesntMangleUnicodeIncludes) { |
| 16 | + const char* directory_name = "test_shader_include_�"; |
| 17 | + fml::CreateDirectory(flutter::testing::OpenFixturesDirectory(), |
| 18 | + {directory_name}, fml::FilePermission::kRead); |
| 19 | + |
| 20 | + auto include_path = |
| 21 | + std::string(flutter::testing::GetFixturesPath()) + "/" + directory_name; |
| 22 | + auto include_option = "--include=" + include_path; |
| 23 | + |
| 24 | + const auto cl = fml::CommandLineFromInitializerList( |
| 25 | + {"impellerc", "--opengl-desktop", "--input=input.vert", |
| 26 | + "--sl=output.vert", "--spirv=output.spirv", include_option.c_str()}); |
| 27 | + Switches switches(cl); |
| 28 | + ASSERT_TRUE(switches.AreValid(std::cout)); |
| 29 | + ASSERT_EQ(switches.include_directories.size(), 1u); |
| 30 | + ASSERT_NE(switches.include_directories[0].dir, nullptr); |
| 31 | + ASSERT_EQ(switches.include_directories[0].name, include_path); |
| 32 | +} |
| 33 | + |
| 34 | +} // namespace testing |
| 35 | +} // namespace compiler |
| 36 | +} // namespace impeller |
0 commit comments