提交 a7db19b3 编写于 作者: J Johannes Rieken

move marshalling tests to its own file

上级 2481a7da
/*---------------------------------------------------------------------------------------------
* 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());
});
});
\ No newline at end of file
......@@ -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);
});
});
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册