summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-06-26 14:09:02 +0200
committerGitHub <noreply@github.com>2020-06-26 08:09:02 -0400
commit4817c153e47975b0b4390ec41b68240c4257f599 (patch)
tree0a7d50d1cc72297d963d2d44d2878f201e11674c /cli/tests
parentd1b44e7521e4d68e4db68e05b6c4f764569fd5bc (diff)
Re-land "fix(cli): ipv6 parsing for --allow-net params" (#6472)
With some minor adjustments
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/complex_permissions_test.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/cli/tests/complex_permissions_test.ts b/cli/tests/complex_permissions_test.ts
index ad8b5302c..f4b8e6c73 100644
--- a/cli/tests/complex_permissions_test.ts
+++ b/cli/tests/complex_permissions_test.ts
@@ -14,7 +14,11 @@ const test: { [key: string]: Function } = {
},
netListen(endpoints: string[]): void {
endpoints.forEach((endpoint) => {
- const [hostname, port] = endpoint.split(":");
+ const index = endpoint.lastIndexOf(":");
+ const [hostname, port] = [
+ endpoint.substr(0, index),
+ endpoint.substr(index + 1),
+ ];
const listener = Deno.listen({
transport: "tcp",
hostname,
@@ -25,7 +29,11 @@ const test: { [key: string]: Function } = {
},
async netConnect(endpoints: string[]): Promise<void> {
for (const endpoint of endpoints) {
- const [hostname, port] = endpoint.split(":");
+ const index = endpoint.lastIndexOf(":");
+ const [hostname, port] = [
+ endpoint.substr(0, index),
+ endpoint.substr(index + 1),
+ ];
const listener = await Deno.connect({
transport: "tcp",
hostname,