CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
72 lines
2.7 KiB
C++
72 lines
2.7 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "ClientLauncher.h"
|
|
#include "llvm/ADT/StringRef.h"
|
|
#include "gtest/gtest.h"
|
|
#include <optional>
|
|
|
|
using namespace lldb_dap;
|
|
using namespace llvm;
|
|
|
|
TEST(ClientLauncherTest, GetClientFromVSCode) {
|
|
std::optional<ClientLauncher::Client> result =
|
|
ClientLauncher::GetClientFrom("vscode");
|
|
ASSERT_TRUE(result.has_value());
|
|
EXPECT_EQ(ClientLauncher::VSCode, result.value());
|
|
}
|
|
|
|
TEST(ClientLauncherTest, GetClientFromVSCodeUpperCase) {
|
|
std::optional<ClientLauncher::Client> result =
|
|
ClientLauncher::GetClientFrom("VSCODE");
|
|
ASSERT_TRUE(result.has_value());
|
|
EXPECT_EQ(ClientLauncher::VSCode, result.value());
|
|
}
|
|
|
|
TEST(ClientLauncherTest, GetClientFromVSCodeMixedCase) {
|
|
std::optional<ClientLauncher::Client> result =
|
|
ClientLauncher::GetClientFrom("VSCode");
|
|
ASSERT_TRUE(result.has_value());
|
|
EXPECT_EQ(ClientLauncher::VSCode, result.value());
|
|
}
|
|
|
|
TEST(ClientLauncherTest, GetClientFromInvalidString) {
|
|
std::optional<ClientLauncher::Client> result =
|
|
ClientLauncher::GetClientFrom("invalid");
|
|
EXPECT_FALSE(result.has_value());
|
|
}
|
|
|
|
TEST(ClientLauncherTest, GetClientFromEmptyString) {
|
|
std::optional<ClientLauncher::Client> result =
|
|
ClientLauncher::GetClientFrom("");
|
|
EXPECT_FALSE(result.has_value());
|
|
}
|
|
|
|
TEST(ClientLauncherTest, URLEncode) {
|
|
EXPECT_EQ("", VSCodeLauncher::URLEncode(""));
|
|
EXPECT_EQ(
|
|
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~",
|
|
VSCodeLauncher::URLEncode("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST"
|
|
"UVWXYZ0123456789-_.~"));
|
|
EXPECT_EQ("hello%20world", VSCodeLauncher::URLEncode("hello world"));
|
|
EXPECT_EQ("hello%21%40%23%24", VSCodeLauncher::URLEncode("hello!@#$"));
|
|
EXPECT_EQ("%2Fpath%2Fto%2Ffile", VSCodeLauncher::URLEncode("/path/to/file"));
|
|
EXPECT_EQ("key%3Dvalue%26key2%3Dvalue2",
|
|
VSCodeLauncher::URLEncode("key=value&key2=value2"));
|
|
EXPECT_EQ("100%25complete", VSCodeLauncher::URLEncode("100%complete"));
|
|
EXPECT_EQ("file_name%20with%20spaces%20%26%20special%21.txt",
|
|
VSCodeLauncher::URLEncode("file_name with spaces & special!.txt"));
|
|
EXPECT_EQ("%00%01%02",
|
|
VSCodeLauncher::URLEncode(llvm::StringRef("\x00\x01\x02", 3)));
|
|
EXPECT_EQ("test-file_name.txt~",
|
|
VSCodeLauncher::URLEncode("test-file_name.txt~"));
|
|
|
|
// UTF-8 encoded characters should be percent-encoded byte by byte.
|
|
EXPECT_EQ("%C3%A9", VSCodeLauncher::URLEncode("é"));
|
|
}
|