Skip to content

Commit

Permalink
adding test for undici issue 971 (#611)
Browse files Browse the repository at this point in the history
* adding test for nodejs/undici#2971

* lint
  • Loading branch information
lemire committed Mar 19, 2024
1 parent 59e7074 commit 0170547
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
14 changes: 14 additions & 0 deletions tests/basic_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,17 @@ TYPED_TEST(basic_tests, nodejs_51619) {
ASSERT_FALSE(out);
SUCCEED();
}

// https://github.com/nodejs/undici/pull/2971
TYPED_TEST(basic_tests, nodejs_undici_2971) {
std::string_view base =
"https://non-ascii-location-header.sys.workers.dev/redirect";
auto base_url = ada::parse<TypeParam>(base);
ASSERT_TRUE(base_url);
auto out = ada::parse<TypeParam>("/\xec\x95\x88\xeb\x85\x95", &*base_url);
ASSERT_TRUE(out);
ASSERT_EQ(
out->get_href(),
R"(https://non-ascii-location-header.sys.workers.dev/%EC%95%88%EB%85%95)");
SUCCEED();
}
25 changes: 8 additions & 17 deletions tools/run-clangcldocker.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
#!/usr/bin/env bash
set -e
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
ROOT_PATH=$SCRIPT_PATH/..
ALL_ADA_FILES=$(cd "$ROOT_PATH" && git ls-tree --full-tree --name-only -r HEAD | grep -e ".*\.\(c\|h\|cc\|cpp\|hh\)\$" | grep -vFf clang-format-ignore.txt)
COMMAND=$*
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
MAINSOURCE=$SCRIPTPATH/..
ALL_ADA_FILES=$(cd $MAINSOURCE && git ls-tree --full-tree --name-only -r HEAD | grep -e ".*\.\(c\|h\|cc\|cpp\|hh\)\$" | grep -vFf clang-format-ignore.txt)

if clang-format-15 --version 2>/dev/null | grep -qF 'version 15.'; then
cd "$ROOT_PATH"; clang-format-15 --style=file --verbose -i "$@" "$ALL_ADA_FILES"
cd $MAINSOURCE; clang-format-15 --style=file --verbose -i "$@" $ALL_ADA_FILES
exit 0
elif clang-format --version 2>/dev/null | grep -qF 'version 15.'; then
cd "$ROOT_PATH"; clang-format --style=file --verbose -i "$@" "$ALL_ADA_FILES"
cd $MAINSOURCE; clang-format --style=file --verbose -i "$@" $ALL_ADA_FILES
exit 0
fi
echo "Trying to use docker"
command -v docker >/dev/null 2>&1 || { echo >&2 "Please install docker. E.g., go to https://www.docker.com/products/docker-desktop Type 'docker' to diagnose the problem."; exit 1; }
docker info >/dev/null 2>&1 || { echo >&2 "Docker server is not running? type 'docker info'."; exit 1; }

if [ -t 0 ];
then DOCKER_ARGS=-it;
fi

if [ -t 0 ]; then DOCKER_ARGS=-it; fi
docker pull kszonek/clang-format-15

docker run --rm $DOCKER_ARGS \
-v "$ROOT_PATH":"$ROOT_PATH":Z \
-w "$ROOT_PATH" \
-u "$(id -u "$USER"):$(id -g "$USER")" \
kszonek/clang-format-15 \
--style=file \
--verbose \
-i "$@" "$ALL_ADA_FILES"
docker run --rm $DOCKER_ARGS -v "$MAINSOURCE":"$MAINSOURCE":Z -w "$MAINSOURCE" -u "$(id -u $USER):$(id -g $USER)" kszonek/clang-format-15 --style=file --verbose -i "$@" $ALL_ADA_FILES

0 comments on commit 0170547

Please sign in to comment.