2015-06-11 21:01:19 +02:00
|
|
|
/// <reference path="..\..\..\src\harness\harness.ts" />
|
2015-04-08 07:54:06 +02:00
|
|
|
|
|
|
|
module ts {
|
|
|
|
describe('convertToBase64', () => {
|
|
|
|
function runTest(input: string): void {
|
|
|
|
var actual = ts.convertToBase64(input);
|
|
|
|
var expected = new Buffer(input).toString("base64");
|
|
|
|
assert.equal(actual, expected, "Encoded string using convertToBase64 does not match buffer.toString('base64')");
|
|
|
|
}
|
|
|
|
|
2015-06-11 21:11:56 +02:00
|
|
|
it("Converts ASCII charaters correctly", () => {
|
2015-04-08 07:54:06 +02:00
|
|
|
runTest(" !\"#$ %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
|
|
|
|
});
|
|
|
|
|
2015-06-11 21:11:56 +02:00
|
|
|
it("Converts escape sequences correctly", () => {
|
2015-04-08 07:54:06 +02:00
|
|
|
runTest("\t\n\r\\\"\'\u0062");
|
|
|
|
});
|
|
|
|
|
2015-06-11 21:11:56 +02:00
|
|
|
it("Converts simple unicode characters correctly", () => {
|
2015-04-08 07:54:06 +02:00
|
|
|
runTest("ΠΣ ٵپ औठ ⺐⺠");
|
|
|
|
});
|
|
|
|
|
2015-06-11 21:11:56 +02:00
|
|
|
it("Converts simple code snippet correctly", () => {
|
2015-04-08 07:54:06 +02:00
|
|
|
runTest(`/// <reference path="file.ts" />
|
|
|
|
var x: string = "string";
|
|
|
|
console.log(x);`);
|
|
|
|
});
|
|
|
|
|
2015-06-11 21:11:56 +02:00
|
|
|
it("Converts simple code snippet with unicode characters correctly", () => {
|
2015-04-08 07:54:06 +02:00
|
|
|
runTest(`var Π = 3.1415; console.log(Π);`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|