From ca60914d78e03f54083900fee404e9838ece657f Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 3 Jul 2018 16:49:32 -0700 Subject: [PATCH] Test for joinPath --- src/vs/base/test/common/resources.test.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/vs/base/test/common/resources.test.ts b/src/vs/base/test/common/resources.test.ts index 2c1e18bf6ef..6a613730db3 100644 --- a/src/vs/base/test/common/resources.test.ts +++ b/src/vs/base/test/common/resources.test.ts @@ -5,9 +5,9 @@ 'use strict'; import * as assert from 'assert'; -import URI from 'vs/base/common/uri'; -import { distinctParents, dirname } from 'vs/base/common/resources'; import { normalize } from 'vs/base/common/paths'; +import { dirname, distinctParents, joinPath } from 'vs/base/common/resources'; +import URI from 'vs/base/common/uri'; suite('Resources', () => { @@ -50,4 +50,22 @@ suite('Resources', () => { // does not explode (https://github.com/Microsoft/vscode/issues/41987) dirname(URI.from({ scheme: 'file', authority: '/users/someone/portal.h' })); }); + + test('joinPath', () => { + assert.equal( + joinPath(URI.file('/foo/bar'), '/file.js').toString(), + 'file:///foo/bar/file.js'); + + assert.equal( + joinPath(URI.file('/foo/bar/'), '/file.js').toString(), + 'file:///foo/bar/file.js'); + + assert.equal( + joinPath(URI.file('/'), '/file.js').toString(), + 'file:///file.js'); + + assert.equal( + joinPath(URI.from({ scheme: 'myScheme', authority: 'authority', path: '/path', query: 'query', fragment: 'fragment' }), '/file.js').toString(), + 'myScheme://authority/path/file.js?query#fragment'); + }); }); \ No newline at end of file -- GitLab