mirror of
https://github.com/Microsoft/vscode
synced 2024-09-20 19:18:03 +00:00
move marshalling tests to its own file
This commit is contained in:
parent
2481a7dad8
commit
a7db19b3eb
40
src/vs/base/test/common/marshalling.test.ts
Normal file
40
src/vs/base/test/common/marshalling.test.ts
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import {parse, stringify} from 'vs/base/common/marshalling';
|
||||
|
||||
suite('Marshalling', () => {
|
||||
|
||||
test('RegExp', function() {
|
||||
let value = /foo/img;
|
||||
let raw = stringify(value);
|
||||
let clone = <RegExp> parse(raw);
|
||||
|
||||
assert.equal(value.source, clone.source);
|
||||
assert.equal(value.global, clone.global);
|
||||
assert.equal(value.ignoreCase, clone.ignoreCase);
|
||||
assert.equal(value.multiline, clone.multiline);
|
||||
});
|
||||
|
||||
test('URI', function () {
|
||||
let value = URI.from({ scheme: 'file', authority: 'server', path: '/shares/c#files', query: 'q', fragment: 'f' });
|
||||
let raw = stringify(value);
|
||||
let clone = <URI> parse(raw);
|
||||
|
||||
assert.equal(value.scheme, clone.scheme);
|
||||
assert.equal(value.authority, clone.authority);
|
||||
assert.equal(value.path, clone.path);
|
||||
assert.equal(value.query, clone.query);
|
||||
assert.equal(value.fragment, clone.fragment);
|
||||
});
|
||||
|
||||
test('Bug 16793:# in folder name => mirror models get out of sync', () => {
|
||||
var uri1 = URI.file('C:\\C#\\file.txt');
|
||||
assert.equal(parse(stringify(uri1)).toString(), uri1.toString());
|
||||
});
|
||||
});
|
|
@ -6,8 +6,7 @@
|
|||
|
||||
import * as assert from 'assert';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { parse, stringify } from 'vs/base/common/marshalling';
|
||||
import { normalize } from 'vs/base/common/paths';
|
||||
import {normalize} from 'vs/base/common/paths';
|
||||
|
||||
suite('URI', () => {
|
||||
test('file#toString', () => {
|
||||
|
@ -311,13 +310,29 @@ suite('URI', () => {
|
|||
test('file://monacotools1/certificates/SSL/', '\\\\monacotools1\\certificates\\SSL\\');
|
||||
});
|
||||
|
||||
test('Bug 16793:# in folder name => mirror models get out of sync', () => {
|
||||
var uri1 = URI.file('C:\\C#\\file.txt');
|
||||
assert.equal(parse(stringify(uri1)).toString(), uri1.toString());
|
||||
test('URI - http, query & toString', function() {
|
||||
|
||||
let uri = URI.parse('https://go.microsoft.com/fwlink/?LinkId=518008');
|
||||
assert.equal(uri.query, 'LinkId=518008');
|
||||
assert.equal(uri.toString(true), 'https://go.microsoft.com/fwlink/?LinkId=518008');
|
||||
assert.equal(uri.toString(), 'https://go.microsoft.com/fwlink/?LinkId%3D518008');
|
||||
|
||||
let uri2 = URI.parse(uri.toString());
|
||||
assert.equal(uri2.query, 'LinkId=518008');
|
||||
assert.equal(uri2.query, uri.query);
|
||||
|
||||
uri = URI.parse('https://go.microsoft.com/fwlink/?LinkId=518008&foö&ké¥=üü');
|
||||
assert.equal(uri.query, 'LinkId=518008&foö&ké¥=üü');
|
||||
assert.equal(uri.toString(true), 'https://go.microsoft.com/fwlink/?LinkId=518008&foö&ké¥=üü');
|
||||
assert.equal(uri.toString(), 'https://go.microsoft.com/fwlink/?LinkId%3D518008%26fo%C3%B6%26k%C3%A9%C2%A5%3D%C3%BC%C3%BC');
|
||||
|
||||
uri2 = URI.parse(uri.toString());
|
||||
assert.equal(uri2.query, 'LinkId=518008&foö&ké¥=üü');
|
||||
assert.equal(uri2.query, uri.query);
|
||||
});
|
||||
|
||||
|
||||
test('URI - (de)serialize', function() {
|
||||
test('URI - (de)serialize', function () {
|
||||
|
||||
var values = [
|
||||
URI.parse('http://localhost:8080/far'),
|
||||
|
@ -346,25 +361,4 @@ suite('URI', () => {
|
|||
// }
|
||||
// console.profileEnd();
|
||||
});
|
||||
|
||||
test('URI - http, query & toString', function() {
|
||||
|
||||
let uri = URI.parse('https://go.microsoft.com/fwlink/?LinkId=518008');
|
||||
assert.equal(uri.query, 'LinkId=518008');
|
||||
assert.equal(uri.toString(true), 'https://go.microsoft.com/fwlink/?LinkId=518008');
|
||||
assert.equal(uri.toString(), 'https://go.microsoft.com/fwlink/?LinkId%3D518008');
|
||||
|
||||
let uri2 = URI.parse(uri.toString());
|
||||
assert.equal(uri2.query, 'LinkId=518008');
|
||||
assert.equal(uri2.query, uri.query);
|
||||
|
||||
uri = URI.parse('https://go.microsoft.com/fwlink/?LinkId=518008&foö&ké¥=üü');
|
||||
assert.equal(uri.query, 'LinkId=518008&foö&ké¥=üü');
|
||||
assert.equal(uri.toString(true), 'https://go.microsoft.com/fwlink/?LinkId=518008&foö&ké¥=üü');
|
||||
assert.equal(uri.toString(), 'https://go.microsoft.com/fwlink/?LinkId%3D518008%26fo%C3%B6%26k%C3%A9%C2%A5%3D%C3%BC%C3%BC');
|
||||
|
||||
uri2 = URI.parse(uri.toString());
|
||||
assert.equal(uri2.query, 'LinkId=518008&foö&ké¥=üü');
|
||||
assert.equal(uri2.query, uri.query);
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue