diff --git a/js/blob_test.ts b/js/blob_test.ts index ed0f9d89c3..1e8ec8fbd1 100644 --- a/js/blob_test.ts +++ b/js/blob_test.ts @@ -1,11 +1,11 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assert, assertEqual } from "./test_util.ts"; +import { test, assert, assertEquals } from "./test_util.ts"; test(function blobString() { const b1 = new Blob(["Hello World"]); const str = "Test"; const b2 = new Blob([b1, str]); - assertEqual(b2.size, b1.size + str.length); + assertEquals(b2.size, b1.size + str.length); }); test(function blobBuffer() { @@ -13,23 +13,23 @@ test(function blobBuffer() { const u8 = new Uint8Array(buffer); const f1 = new Float32Array(buffer); const b1 = new Blob([buffer, u8]); - assertEqual(b1.size, 2 * u8.length); + assertEquals(b1.size, 2 * u8.length); const b2 = new Blob([b1, f1]); - assertEqual(b2.size, 3 * u8.length); + assertEquals(b2.size, 3 * u8.length); }); test(function blobSlice() { const blob = new Blob(["Deno", "Foo"]); const b1 = blob.slice(0, 3, "Text/HTML"); assert(b1 instanceof Blob); - assertEqual(b1.size, 3); - assertEqual(b1.type, "text/html"); + assertEquals(b1.size, 3); + assertEquals(b1.type, "text/html"); const b2 = blob.slice(-1, 3); - assertEqual(b2.size, 0); + assertEquals(b2.size, 0); const b3 = blob.slice(100, 3); - assertEqual(b3.size, 0); + assertEquals(b3.size, 0); const b4 = blob.slice(0, 10); - assertEqual(b4.size, blob.size); + assertEquals(b4.size, blob.size); }); // TODO(qti3e) Test the stored data in a Blob after implementing FileReader API. diff --git a/js/buffer_test.ts b/js/buffer_test.ts index 61208d21b3..691d97e205 100644 --- a/js/buffer_test.ts +++ b/js/buffer_test.ts @@ -3,7 +3,7 @@ // This code has been ported almost directly from Go's src/bytes/buffer_test.go // Copyright 2009 The Go Authors. All rights reserved. BSD license. // https://github.com/golang/go/blob/master/LICENSE -import { assertEqual, test } from "./test_util.ts"; +import { assertEquals, test } from "./test_util.ts"; const { Buffer, readAll } = Deno; type Buffer = Deno.Buffer; @@ -26,12 +26,12 @@ function init() { function check(buf: Deno.Buffer, s: string) { const bytes = buf.bytes(); - assertEqual(buf.length, bytes.byteLength); + assertEquals(buf.length, bytes.byteLength); const decoder = new TextDecoder(); const bytesStr = decoder.decode(bytes); - assertEqual(bytesStr, s); - assertEqual(buf.length, buf.toString().length); - assertEqual(buf.length, s.length); + assertEquals(bytesStr, s); + assertEquals(buf.length, buf.toString().length); + assertEquals(buf.length, s.length); } // Fill buf through n writes of byte slice fub. @@ -46,7 +46,7 @@ async function fillBytes( check(buf, s); for (; n > 0; n--) { let m = await buf.write(fub); - assertEqual(m, fub.byteLength); + assertEquals(m, fub.byteLength); const decoder = new TextDecoder(); s += decoder.decode(fub); check(buf, s); @@ -88,15 +88,15 @@ test(async function bufferBasicOperations() { check(buf, ""); let n = await buf.write(testBytes.subarray(0, 1)); - assertEqual(n, 1); + assertEquals(n, 1); check(buf, "a"); n = await buf.write(testBytes.subarray(1, 2)); - assertEqual(n, 1); + assertEquals(n, 1); check(buf, "ab"); n = await buf.write(testBytes.subarray(2, 26)); - assertEqual(n, 24); + assertEquals(n, 24); check(buf, testString.slice(0, 26)); buf.truncate(26); @@ -119,8 +119,8 @@ test(async function bufferReadEmptyAtEOF() { let buf = new Buffer(); const zeroLengthTmp = new Uint8Array(0); let result = await buf.read(zeroLengthTmp); - assertEqual(result.nread, 0); - assertEqual(result.eof, false); + assertEquals(result.nread, 0); + assertEquals(result.eof, false); }); test(async function bufferLargeByteWrites() { @@ -149,8 +149,8 @@ test(async function bufferTooLargeByteWrites() { err = e; } - assertEqual(err.kind, Deno.ErrorKind.TooLarge); - assertEqual(err.name, "TooLarge"); + assertEquals(err.kind, Deno.ErrorKind.TooLarge); + assertEquals(err.name, "TooLarge"); }); test(async function bufferLargeByteReads() { @@ -166,7 +166,7 @@ test(async function bufferLargeByteReads() { test(function bufferCapWithPreallocatedSlice() { const buf = new Buffer(new ArrayBuffer(10)); - assertEqual(buf.capacity, 10); + assertEquals(buf.capacity, 10); }); test(async function bufferReadFrom() { @@ -187,7 +187,7 @@ test(async function bufferReadFrom() { }); function repeat(c: string, bytes: number): Uint8Array { - assertEqual(c.length, 1); + assertEquals(c.length, 1); const ui8 = new Uint8Array(bytes); ui8.fill(c.charCodeAt(0)); return ui8; @@ -205,11 +205,11 @@ test(async function bufferTestGrow() { const yBytes = repeat("y", growLen); await buf.write(yBytes); // Check that buffer has correct data. - assertEqual( + assertEquals( buf.bytes().subarray(0, startLen - nread), xBytes.subarray(nread) ); - assertEqual( + assertEquals( buf.bytes().subarray(startLen - nread, startLen - nread + growLen), yBytes ); @@ -221,8 +221,8 @@ test(async function testReadAll() { init(); const reader = new Buffer(testBytes.buffer as ArrayBuffer); const actualBytes = await readAll(reader); - assertEqual(testBytes.byteLength, actualBytes.byteLength); + assertEquals(testBytes.byteLength, actualBytes.byteLength); for (let i = 0; i < testBytes.length; ++i) { - assertEqual(testBytes[i], actualBytes[i]); + assertEquals(testBytes[i], actualBytes[i]); } }); diff --git a/js/chmod_test.ts b/js/chmod_test.ts index f6eac05b05..32e3ed1d15 100644 --- a/js/chmod_test.ts +++ b/js/chmod_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assertEqual } from "./test_util.ts"; +import { testPerm, assertEquals } from "./test_util.ts"; const isNotWindows = Deno.build.os !== "win"; @@ -16,7 +16,7 @@ testPerm({ read: true, write: true }, function chmodSyncSuccess() { // Check success when not on windows if (isNotWindows) { const fileInfo = Deno.statSync(filename); - assertEqual(fileInfo.mode & 0o777, 0o777); + assertEquals(fileInfo.mode & 0o777, 0o777); } }); @@ -39,9 +39,9 @@ if (isNotWindows) { // Change actual file mode, not symlink const fileInfo = Deno.statSync(filename); - assertEqual(fileInfo.mode & 0o777, 0o777); + assertEquals(fileInfo.mode & 0o777, 0o777); symlinkInfo = Deno.lstatSync(symlinkName); - assertEqual(symlinkInfo.mode & 0o777, symlinkMode); + assertEquals(symlinkInfo.mode & 0o777, symlinkMode); }); } @@ -53,8 +53,8 @@ testPerm({ write: true }, function chmodSyncFailure() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: false }, function chmodSyncPerm() { @@ -64,8 +64,8 @@ testPerm({ write: false }, function chmodSyncPerm() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); testPerm({ read: true, write: true }, async function chmodSuccess() { @@ -81,7 +81,7 @@ testPerm({ read: true, write: true }, async function chmodSuccess() { // Check success when not on windows if (isNotWindows) { const fileInfo = Deno.statSync(filename); - assertEqual(fileInfo.mode & 0o777, 0o777); + assertEquals(fileInfo.mode & 0o777, 0o777); } }); @@ -104,9 +104,9 @@ if (isNotWindows) { // Just change actual file mode, not symlink const fileInfo = Deno.statSync(filename); - assertEqual(fileInfo.mode & 0o777, 0o777); + assertEquals(fileInfo.mode & 0o777, 0o777); symlinkInfo = Deno.lstatSync(symlinkName); - assertEqual(symlinkInfo.mode & 0o777, symlinkMode); + assertEquals(symlinkInfo.mode & 0o777, symlinkMode); }); } @@ -118,8 +118,8 @@ testPerm({ write: true }, async function chmodFailure() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: false }, async function chmodPerm() { @@ -129,6 +129,6 @@ testPerm({ write: false }, async function chmodPerm() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); diff --git a/js/compiler_test.ts b/js/compiler_test.ts index a6385c7438..e8101995e6 100644 --- a/js/compiler_test.ts +++ b/js/compiler_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assert, assertEqual } from "./test_util.ts"; +import { test, assert, assertEquals } from "./test_util.ts"; // We use a silly amount of `any` in these tests... // tslint:disable:no-any @@ -370,8 +370,8 @@ function teardown() { logStack = []; getEmitOutputStack = []; - assertEqual(mockDepsStack.length, 0); - assertEqual(mockFactoryStack.length, 0); + assertEquals(mockDepsStack.length, 0); + assertEquals(mockFactoryStack.length, 0); mockDepsStack = []; mockFactoryStack = []; @@ -384,7 +384,7 @@ test(function testJsonEsmTemplate() { `{ "hello": "world", "foo": "bar" }`, "/foo.ts" ); - assertEqual( + assertEquals( result, `const _json = JSON.parse(\`{ "hello": "world", "foo": "bar" }\`)\n` + `export default _json;\n` + @@ -406,24 +406,24 @@ test(function compilerCompile() { "foo/bar.ts", "/root/project" ); - assertEqual(moduleMetaData.sourceCode, fooBarTsSource); - assertEqual(moduleMetaData.outputCode, fooBarTsOutput); + assertEquals(moduleMetaData.sourceCode, fooBarTsSource); + assertEquals(moduleMetaData.outputCode, fooBarTsOutput); - assertEqual( + assertEquals( codeFetchStack.length, 1, "Module should have only been fetched once." ); - assertEqual( + assertEquals( codeCacheStack.length, 1, "Compiled code should have only been cached once." ); const [codeCacheCall] = codeCacheStack; - assertEqual(codeCacheCall.fileName, "/root/project/foo/bar.ts"); - assertEqual(codeCacheCall.sourceCode, fooBarTsSource); - assertEqual(codeCacheCall.outputCode, fooBarTsOutput); - assertEqual(codeCacheCall.sourceMap, fooBarTsSourcemap); + assertEquals(codeCacheCall.fileName, "/root/project/foo/bar.ts"); + assertEquals(codeCacheCall.sourceCode, fooBarTsSource); + assertEquals(codeCacheCall.outputCode, fooBarTsOutput); + assertEquals(codeCacheCall.sourceMap, fooBarTsSourcemap); teardown(); }); @@ -431,16 +431,16 @@ test(function compilerCompilerMultiModule() { // equal to `deno foo/baz.ts` setup(); compilerInstance.compile("foo/baz.ts", "/root/project"); - assertEqual(codeFetchStack.length, 2, "Two modules fetched."); - assertEqual(codeCacheStack.length, 1, "Only one module compiled."); + assertEquals(codeFetchStack.length, 2, "Two modules fetched."); + assertEquals(codeCacheStack.length, 1, "Only one module compiled."); teardown(); }); test(function compilerLoadJsonModule() { setup(); compilerInstance.compile("loadConfig.ts", "/root/project"); - assertEqual(codeFetchStack.length, 2, "Two modules fetched."); - assertEqual(codeCacheStack.length, 1, "Only one module compiled."); + assertEquals(codeFetchStack.length, 2, "Two modules fetched."); + assertEquals(codeCacheStack.length, 1, "Only one module compiled."); teardown(); }); @@ -451,12 +451,12 @@ test(function compilerResolveModule() { "/root/project" ); console.log(moduleMetaData); - assertEqual(moduleMetaData.sourceCode, fooBazTsSource); - assertEqual(moduleMetaData.outputCode, null); - assertEqual(moduleMetaData.sourceMap, null); - assertEqual(moduleMetaData.scriptVersion, "1"); + assertEquals(moduleMetaData.sourceCode, fooBazTsSource); + assertEquals(moduleMetaData.outputCode, null); + assertEquals(moduleMetaData.sourceMap, null); + assertEquals(moduleMetaData.scriptVersion, "1"); - assertEqual(codeFetchStack.length, 1, "Only initial module is resolved."); + assertEquals(codeFetchStack.length, 1, "Only initial module is resolved."); teardown(); }); @@ -467,7 +467,7 @@ test(function compilerResolveModuleUnknownMediaType() { compilerInstance.resolveModule("some.txt", "/root/project"); } catch (e) { assert(e instanceof Error); - assertEqual( + assertEquals( e.message, `Unknown media type for: "some.txt" from "/root/project".` ); @@ -480,21 +480,21 @@ test(function compilerResolveModuleUnknownMediaType() { test(function compilerRecompileFlag() { setup(); compilerInstance.compile("foo/bar.ts", "/root/project"); - assertEqual( + assertEquals( getEmitOutputStack.length, 1, "Expected only a single emitted file." ); // running compiler against same file should use cached code compilerInstance.compile("foo/bar.ts", "/root/project"); - assertEqual( + assertEquals( getEmitOutputStack.length, 1, "Expected only a single emitted file." ); compilerInstance.recompile = true; compilerInstance.compile("foo/bar.ts", "/root/project"); - assertEqual(getEmitOutputStack.length, 2, "Expected two emitted file."); + assertEquals(getEmitOutputStack.length, 2, "Expected two emitted file."); assert( getEmitOutputStack[0] === getEmitOutputStack[1], "Expected same file to be emitted twice." @@ -520,20 +520,20 @@ test(function compilerGetCompilationSettings() { for (const key of expectedKeys) { assert(key in result, `Expected "${key}" in compiler options.`); } - assertEqual(Object.keys(result).length, expectedKeys.length); + assertEquals(Object.keys(result).length, expectedKeys.length); }); test(function compilerGetNewLine() { const result = compilerInstance.getNewLine(); - assertEqual(result, "\n", "Expected newline value of '\\n'."); + assertEquals(result, "\n", "Expected newline value of '\\n'."); }); test(function compilerGetScriptFileNames() { setup(); compilerInstance.compile("foo/bar.ts", "/root/project"); const result = compilerInstance.getScriptFileNames(); - assertEqual(result.length, 1, "Expected only a single filename."); - assertEqual(result[0], "/root/project/foo/bar.ts"); + assertEquals(result.length, 1, "Expected only a single filename."); + assertEquals(result[0], "/root/project/foo/bar.ts"); teardown(); }); @@ -544,23 +544,23 @@ test(function compilerGetScriptKind() { compilerInstance.resolveModule("foo.js", "/moduleKinds"); compilerInstance.resolveModule("foo.json", "/moduleKinds"); compilerInstance.resolveModule("foo.txt", "/moduleKinds"); - assertEqual( + assertEquals( compilerInstance.getScriptKind("/moduleKinds/foo.ts"), ScriptKind.TS ); - assertEqual( + assertEquals( compilerInstance.getScriptKind("/moduleKinds/foo.d.ts"), ScriptKind.TS ); - assertEqual( + assertEquals( compilerInstance.getScriptKind("/moduleKinds/foo.js"), ScriptKind.JS ); - assertEqual( + assertEquals( compilerInstance.getScriptKind("/moduleKinds/foo.json"), ScriptKind.JSON ); - assertEqual( + assertEquals( compilerInstance.getScriptKind("/moduleKinds/foo.txt"), ScriptKind.JS ); @@ -573,7 +573,7 @@ test(function compilerGetScriptVersion() { "foo/bar.ts", "/root/project" ); - assertEqual( + assertEquals( compilerInstance.getScriptVersion(moduleMetaData.fileName), "1", "Expected known module to have script version of 1" @@ -582,7 +582,7 @@ test(function compilerGetScriptVersion() { }); test(function compilerGetScriptVersionUnknown() { - assertEqual( + assertEquals( compilerInstance.getScriptVersion("/root/project/unknown_module.ts"), "", "Expected unknown module to have an empty script version" @@ -597,13 +597,13 @@ test(function compilerGetScriptSnapshot() { ); const result = compilerInstance.getScriptSnapshot(moduleMetaData.fileName); assert(result != null, "Expected snapshot to be defined."); - assertEqual(result.getLength(), fooBarTsSource.length); - assertEqual( + assertEquals(result.getLength(), fooBarTsSource.length); + assertEquals( result.getText(0, 6), "import", "Expected .getText() to equal 'import'" ); - assertEqual(result.getChangeRange(result), undefined); + assertEquals(result.getChangeRange(result), undefined); // This is and optional part of the `IScriptSnapshot` API which we don't // define, os checking for the lack of this property. assert(!("dispose" in result)); @@ -616,12 +616,12 @@ test(function compilerGetScriptSnapshot() { }); test(function compilerGetCurrentDirectory() { - assertEqual(compilerInstance.getCurrentDirectory(), ""); + assertEquals(compilerInstance.getCurrentDirectory(), ""); }); test(function compilerGetDefaultLibFileName() { setup(); - assertEqual( + assertEquals( compilerInstance.getDefaultLibFileName(), "$asset$/lib.deno_runtime.d.ts" ); @@ -629,7 +629,7 @@ test(function compilerGetDefaultLibFileName() { }); test(function compilerUseCaseSensitiveFileNames() { - assertEqual(compilerInstance.useCaseSensitiveFileNames(), true); + assertEquals(compilerInstance.useCaseSensitiveFileNames(), true); }); test(function compilerReadFile() { @@ -651,7 +651,7 @@ test(function compilerFileExists() { ); assert(compilerInstance.fileExists(moduleMetaData.fileName)); assert(compilerInstance.fileExists("$asset$/lib.deno_runtime.d.ts")); - assertEqual( + assertEquals( compilerInstance.fileExists("/root/project/unknown-module.ts"), false ); @@ -664,7 +664,7 @@ test(function compilerResolveModuleNames() { ["foo/bar.ts", "foo/baz.ts", "deno"], "/root/project" ); - assertEqual(results.length, 3); + assertEquals(results.length, 3); const fixtures: Array<[string, boolean]> = [ ["/root/project/foo/bar.ts", false], ["/root/project/foo/baz.ts", false], @@ -673,8 +673,8 @@ test(function compilerResolveModuleNames() { for (let i = 0; i < results.length; i++) { const result = results[i]; const [resolvedFileName, isExternalLibraryImport] = fixtures[i]; - assertEqual(result.resolvedFileName, resolvedFileName); - assertEqual(result.isExternalLibraryImport, isExternalLibraryImport); + assertEquals(result.resolvedFileName, resolvedFileName); + assertEquals(result.isExternalLibraryImport, isExternalLibraryImport); } teardown(); }); @@ -685,6 +685,6 @@ test(function compilerResolveEmptyFile() { ["empty_file.ts"], "/moduleKinds" ); - assertEqual(result[0].resolvedFileName, "/moduleKinds/empty_file.ts"); + assertEquals(result[0].resolvedFileName, "/moduleKinds/empty_file.ts"); teardown(); }); diff --git a/js/console_test.ts b/js/console_test.ts index b8ad0ac927..ed99100068 100644 --- a/js/console_test.ts +++ b/js/console_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { assert, assertEqual, test } from "./test_util.ts"; +import { assert, assertEquals, test } from "./test_util.ts"; // Some of these APIs aren't exposed in the types and so we have to cast to any // in order to "trick" TypeScript. @@ -23,13 +23,13 @@ test(function consoleTestAssertShouldNotThrowError() { } catch { hasThrown = true; } - assertEqual(hasThrown, false); + assertEquals(hasThrown, false); }); test(function consoleTestStringifyComplexObjects() { - assertEqual(stringify("foo"), "foo"); - assertEqual(stringify(["foo", "bar"]), `[ "foo", "bar" ]`); - assertEqual(stringify({ foo: "bar" }), `{ foo: "bar" }`); + assertEquals(stringify("foo"), "foo"); + assertEquals(stringify(["foo", "bar"]), `[ "foo", "bar" ]`); + assertEquals(stringify({ foo: "bar" }), `{ foo: "bar" }`); }); test(function consoleTestStringifyCircular() { @@ -76,151 +76,151 @@ test(function consoleTestStringifyCircular() { // tslint:disable-next-line:max-line-length const nestedObjExpected = `{ num: 1, bool: true, str: "a", method: [Function: method], asyncMethod: [AsyncFunction: asyncMethod], generatorMethod: [GeneratorFunction: generatorMethod], un: undefined, nu: null, arrowFunc: [Function: arrowFunc], extendedClass: Extended { a: 1, b: 2 }, nFunc: [Function], extendedCstr: [Function: Extended], o: { num: 2, bool: false, str: "b", method: [Function: method], un: undefined, nu: null, nested: [Circular], emptyObj: {}, arr: [ 1, "s", false, null, [Circular] ], baseClass: Base { a: 1 } } }`; - assertEqual(stringify(1), "1"); - assertEqual(stringify(1n), "1n"); - assertEqual(stringify("s"), "s"); - assertEqual(stringify(false), "false"); + assertEquals(stringify(1), "1"); + assertEquals(stringify(1n), "1n"); + assertEquals(stringify("s"), "s"); + assertEquals(stringify(false), "false"); // tslint:disable-next-line:no-construct - assertEqual(stringify(new Number(1)), "[Number: 1]"); + assertEquals(stringify(new Number(1)), "[Number: 1]"); // tslint:disable-next-line:no-construct - assertEqual(stringify(new Boolean(true)), "[Boolean: true]"); + assertEquals(stringify(new Boolean(true)), "[Boolean: true]"); // tslint:disable-next-line:no-construct - assertEqual(stringify(new String("deno")), `[String: "deno"]`); - assertEqual(stringify(/[0-9]*/), "/[0-9]*/"); - assertEqual( + assertEquals(stringify(new String("deno")), `[String: "deno"]`); + assertEquals(stringify(/[0-9]*/), "/[0-9]*/"); + assertEquals( stringify(new Date("2018-12-10T02:26:59.002Z")), "2018-12-10T02:26:59.002Z" ); - assertEqual(stringify(new Set([1, 2, 3])), "Set { 1, 2, 3 }"); - assertEqual( + assertEquals(stringify(new Set([1, 2, 3])), "Set { 1, 2, 3 }"); + assertEquals( stringify(new Map([[1, "one"], [2, "two"]])), `Map { 1 => "one", 2 => "two" }` ); - assertEqual(stringify(new WeakSet()), "WeakSet { [items unknown] }"); - assertEqual(stringify(new WeakMap()), "WeakMap { [items unknown] }"); - assertEqual(stringify(Symbol(1)), "Symbol(1)"); - assertEqual(stringify(null), "null"); - assertEqual(stringify(undefined), "undefined"); - assertEqual(stringify(new Extended()), "Extended { a: 1, b: 2 }"); - assertEqual(stringify(function f() {}), "[Function: f]"); - assertEqual(stringify(async function af() {}), "[AsyncFunction: af]"); - assertEqual(stringify(function* gf() {}), "[GeneratorFunction: gf]"); - assertEqual( + assertEquals(stringify(new WeakSet()), "WeakSet { [items unknown] }"); + assertEquals(stringify(new WeakMap()), "WeakMap { [items unknown] }"); + assertEquals(stringify(Symbol(1)), "Symbol(1)"); + assertEquals(stringify(null), "null"); + assertEquals(stringify(undefined), "undefined"); + assertEquals(stringify(new Extended()), "Extended { a: 1, b: 2 }"); + assertEquals(stringify(function f() {}), "[Function: f]"); + assertEquals(stringify(async function af() {}), "[AsyncFunction: af]"); + assertEquals(stringify(function* gf() {}), "[GeneratorFunction: gf]"); + assertEquals( stringify(async function* agf() {}), "[AsyncGeneratorFunction: agf]" ); - assertEqual(stringify(new Uint8Array([1, 2, 3])), "Uint8Array [ 1, 2, 3 ]"); - assertEqual(stringify(Uint8Array.prototype), "TypedArray []"); - assertEqual( + assertEquals(stringify(new Uint8Array([1, 2, 3])), "Uint8Array [ 1, 2, 3 ]"); + assertEquals(stringify(Uint8Array.prototype), "TypedArray []"); + assertEquals( stringify({ a: { b: { c: { d: new Set([1]) } } } }), "{ a: { b: { c: { d: [Set] } } } }" ); - assertEqual(stringify(nestedObj), nestedObjExpected); - assertEqual(stringify(JSON), "{}"); - assertEqual( + assertEquals(stringify(nestedObj), nestedObjExpected); + assertEquals(stringify(JSON), "{}"); + assertEquals( stringify(console), // tslint:disable-next-line:max-line-length "Console { printFunc: [Function], log: [Function], debug: [Function], info: [Function], dir: [Function], warn: [Function], error: [Function], assert: [Function], count: [Function], countReset: [Function], table: [Function], time: [Function], timeLog: [Function], timeEnd: [Function], group: [Function], groupCollapsed: [Function], groupEnd: [Function], clear: [Function], indentLevel: 0, collapsedAt: null }" ); // test inspect is working the same - assertEqual(inspect(nestedObj), nestedObjExpected); + assertEquals(inspect(nestedObj), nestedObjExpected); }); test(function consoleTestStringifyWithDepth() { // tslint:disable-next-line:no-any const nestedObj: any = { a: { b: { c: { d: { e: { f: 42 } } } } } }; - assertEqual( + assertEquals( stringifyArgs([nestedObj], { depth: 3 }), "{ a: { b: { c: [Object] } } }\n" ); - assertEqual( + assertEquals( stringifyArgs([nestedObj], { depth: 4 }), "{ a: { b: { c: { d: [Object] } } } }\n" ); - assertEqual(stringifyArgs([nestedObj], { depth: 0 }), "[Object]\n"); - assertEqual( + assertEquals(stringifyArgs([nestedObj], { depth: 0 }), "[Object]\n"); + assertEquals( stringifyArgs([nestedObj], { depth: null }), "{ a: { b: { c: { d: [Object] } } } }\n" ); // test inspect is working the same way - assertEqual( + assertEquals( inspect(nestedObj, { depth: 4 }), "{ a: { b: { c: { d: [Object] } } } }" ); }); test(function consoleTestWithIntegerFormatSpecifier() { - assertEqual(stringify("%i"), "%i"); - assertEqual(stringify("%i", 42.0), "42"); - assertEqual(stringify("%i", 42), "42"); - assertEqual(stringify("%i", "42"), "42"); - assertEqual(stringify("%i", "42.0"), "42"); - assertEqual(stringify("%i", 1.5), "1"); - assertEqual(stringify("%i", -0.5), "0"); - assertEqual(stringify("%i", ""), "NaN"); - assertEqual(stringify("%i", Symbol()), "NaN"); - assertEqual(stringify("%i %d", 42, 43), "42 43"); - assertEqual(stringify("%d %i", 42), "42 %i"); - assertEqual(stringify("%d", 12345678901234567890123), "1"); - assertEqual( + assertEquals(stringify("%i"), "%i"); + assertEquals(stringify("%i", 42.0), "42"); + assertEquals(stringify("%i", 42), "42"); + assertEquals(stringify("%i", "42"), "42"); + assertEquals(stringify("%i", "42.0"), "42"); + assertEquals(stringify("%i", 1.5), "1"); + assertEquals(stringify("%i", -0.5), "0"); + assertEquals(stringify("%i", ""), "NaN"); + assertEquals(stringify("%i", Symbol()), "NaN"); + assertEquals(stringify("%i %d", 42, 43), "42 43"); + assertEquals(stringify("%d %i", 42), "42 %i"); + assertEquals(stringify("%d", 12345678901234567890123), "1"); + assertEquals( stringify("%i", 12345678901234567890123n), "12345678901234567890123n" ); }); test(function consoleTestWithFloatFormatSpecifier() { - assertEqual(stringify("%f"), "%f"); - assertEqual(stringify("%f", 42.0), "42"); - assertEqual(stringify("%f", 42), "42"); - assertEqual(stringify("%f", "42"), "42"); - assertEqual(stringify("%f", "42.0"), "42"); - assertEqual(stringify("%f", 1.5), "1.5"); - assertEqual(stringify("%f", -0.5), "-0.5"); - assertEqual(stringify("%f", Math.PI), "3.141592653589793"); - assertEqual(stringify("%f", ""), "NaN"); - assertEqual(stringify("%f", Symbol("foo")), "NaN"); - assertEqual(stringify("%f", 5n), "5"); - assertEqual(stringify("%f %f", 42, 43), "42 43"); - assertEqual(stringify("%f %f", 42), "42 %f"); + assertEquals(stringify("%f"), "%f"); + assertEquals(stringify("%f", 42.0), "42"); + assertEquals(stringify("%f", 42), "42"); + assertEquals(stringify("%f", "42"), "42"); + assertEquals(stringify("%f", "42.0"), "42"); + assertEquals(stringify("%f", 1.5), "1.5"); + assertEquals(stringify("%f", -0.5), "-0.5"); + assertEquals(stringify("%f", Math.PI), "3.141592653589793"); + assertEquals(stringify("%f", ""), "NaN"); + assertEquals(stringify("%f", Symbol("foo")), "NaN"); + assertEquals(stringify("%f", 5n), "5"); + assertEquals(stringify("%f %f", 42, 43), "42 43"); + assertEquals(stringify("%f %f", 42), "42 %f"); }); test(function consoleTestWithStringFormatSpecifier() { - assertEqual(stringify("%s"), "%s"); - assertEqual(stringify("%s", undefined), "undefined"); - assertEqual(stringify("%s", "foo"), "foo"); - assertEqual(stringify("%s", 42), "42"); - assertEqual(stringify("%s", "42"), "42"); - assertEqual(stringify("%s %s", 42, 43), "42 43"); - assertEqual(stringify("%s %s", 42), "42 %s"); - assertEqual(stringify("%s", Symbol("foo")), "Symbol(foo)"); + assertEquals(stringify("%s"), "%s"); + assertEquals(stringify("%s", undefined), "undefined"); + assertEquals(stringify("%s", "foo"), "foo"); + assertEquals(stringify("%s", 42), "42"); + assertEquals(stringify("%s", "42"), "42"); + assertEquals(stringify("%s %s", 42, 43), "42 43"); + assertEquals(stringify("%s %s", 42), "42 %s"); + assertEquals(stringify("%s", Symbol("foo")), "Symbol(foo)"); }); test(function consoleTestWithObjectFormatSpecifier() { - assertEqual(stringify("%o"), "%o"); - assertEqual(stringify("%o", 42), "42"); - assertEqual(stringify("%o", "foo"), "foo"); - assertEqual(stringify("o: %o, a: %O", {}, []), "o: {}, a: []"); - assertEqual(stringify("%o", { a: 42 }), "{ a: 42 }"); - assertEqual( + assertEquals(stringify("%o"), "%o"); + assertEquals(stringify("%o", 42), "42"); + assertEquals(stringify("%o", "foo"), "foo"); + assertEquals(stringify("o: %o, a: %O", {}, []), "o: {}, a: []"); + assertEquals(stringify("%o", { a: 42 }), "{ a: 42 }"); + assertEquals( stringify("%o", { a: { b: { c: { d: new Set([1]) } } } }), "{ a: { b: { c: { d: [Set] } } } }" ); }); test(function consoleTestWithVariousOrInvalidFormatSpecifier() { - assertEqual(stringify("%s:%s"), "%s:%s"); - assertEqual(stringify("%i:%i"), "%i:%i"); - assertEqual(stringify("%d:%d"), "%d:%d"); - assertEqual(stringify("%%s%s", "foo"), "%sfoo"); - assertEqual(stringify("%s:%s", undefined), "undefined:%s"); - assertEqual(stringify("%s:%s", "foo", "bar"), "foo:bar"); - assertEqual(stringify("%s:%s", "foo", "bar", "baz"), "foo:bar baz"); - assertEqual(stringify("%%%s%%", "hi"), "%hi%"); - assertEqual(stringify("%d:%d", 12), "12:%d"); - assertEqual(stringify("%i:%i", 12), "12:%i"); - assertEqual(stringify("%f:%f", 12), "12:%f"); - assertEqual(stringify("o: %o, a: %o", {}), "o: {}, a: %o"); - assertEqual(stringify("abc%", 1), "abc% 1"); + assertEquals(stringify("%s:%s"), "%s:%s"); + assertEquals(stringify("%i:%i"), "%i:%i"); + assertEquals(stringify("%d:%d"), "%d:%d"); + assertEquals(stringify("%%s%s", "foo"), "%sfoo"); + assertEquals(stringify("%s:%s", undefined), "undefined:%s"); + assertEquals(stringify("%s:%s", "foo", "bar"), "foo:bar"); + assertEquals(stringify("%s:%s", "foo", "bar", "baz"), "foo:bar baz"); + assertEquals(stringify("%%%s%%", "hi"), "%hi%"); + assertEquals(stringify("%d:%d", 12), "12:%d"); + assertEquals(stringify("%i:%i", 12), "12:%i"); + assertEquals(stringify("%f:%f", 12), "12:%f"); + assertEquals(stringify("o: %o, a: %o", {}), "o: {}, a: %o"); + assertEquals(stringify("abc%", 1), "abc% 1"); }); test(function consoleTestCallToStringOnLabel() { @@ -235,7 +235,7 @@ test(function consoleTestCallToStringOnLabel() { } }); - assertEqual(hasCalled, true); + assertEquals(hasCalled, true); } }); @@ -272,7 +272,7 @@ test(function consoleTestClear() { }; console.clear(); stdout.write = stdoutWrite; - assertEqual(buffer, uint8); + assertEquals(buffer, uint8); }); // Test bound this issue @@ -362,7 +362,7 @@ test(function consoleGroup() { console.log("9"); console.log("10"); - assertEqual( + assertEquals( out.toString(), `1 2 @@ -399,7 +399,7 @@ test(function consoleGroupWarn() { console.warn("9"); console.warn("10"); - assertEqual( + assertEquals( both.toString(), `1 2 @@ -418,7 +418,7 @@ test(function consoleGroupWarn() { test(function consoleTable() { mockConsole((console, out) => { console.table({ a: "test", b: 1 }); - assertEqual( + assertEquals( out.toString(), `┌─────────┬────────┐ │ (index) │ Values │ @@ -431,7 +431,7 @@ test(function consoleTable() { }); mockConsole((console, out) => { console.table({ a: { b: 10 }, b: { b: 20, c: 30 } }, ["c"]); - assertEqual( + assertEquals( out.toString(), `┌─────────┬────┐ │ (index) │ c │ @@ -444,7 +444,7 @@ test(function consoleTable() { }); mockConsole((console, out) => { console.table([1, 2, [3, [4]], [5, 6], [[7], [8]]]); - assertEqual( + assertEquals( out.toString(), `┌─────────┬───────┬───────┬────────┐ │ (index) │ 0 │ 1 │ Values │ @@ -460,7 +460,7 @@ test(function consoleTable() { }); mockConsole((console, out) => { console.table(new Set([1, 2, 3, "test"])); - assertEqual( + assertEquals( out.toString(), `┌───────────────────┬────────┐ │ (iteration index) │ Values │ @@ -475,7 +475,7 @@ test(function consoleTable() { }); mockConsole((console, out) => { console.table(new Map([[1, "one"], [2, "two"]])); - assertEqual( + assertEquals( out.toString(), `┌───────────────────┬─────┬────────┐ │ (iteration index) │ Key │ Values │ @@ -494,7 +494,7 @@ test(function consoleTable() { g: new Set([1, 2, 3, "test"]), h: new Map([[1, "one"]]) }); - assertEqual( + assertEquals( out.toString(), `┌─────────┬───────────┬───────────────────┬────────┐ │ (index) │ c │ e │ Values │ @@ -516,7 +516,7 @@ test(function consoleTable() { { a: 10 }, ["test", { b: 20, c: "test" }] ]); - assertEqual( + assertEquals( out.toString(), `┌─────────┬────────┬──────────────────────┬────┬────────┐ │ (index) │ 0 │ 1 │ a │ Values │ @@ -532,7 +532,7 @@ test(function consoleTable() { }); mockConsole((console, out) => { console.table([]); - assertEqual( + assertEquals( out.toString(), `┌─────────┐ │ (index) │ @@ -543,7 +543,7 @@ test(function consoleTable() { }); mockConsole((console, out) => { console.table({}); - assertEqual( + assertEquals( out.toString(), `┌─────────┐ │ (index) │ @@ -554,7 +554,7 @@ test(function consoleTable() { }); mockConsole((console, out) => { console.table(new Set()); - assertEqual( + assertEquals( out.toString(), `┌───────────────────┐ │ (iteration index) │ @@ -565,7 +565,7 @@ test(function consoleTable() { }); mockConsole((console, out) => { console.table(new Map()); - assertEqual( + assertEquals( out.toString(), `┌───────────────────┐ │ (iteration index) │ @@ -576,6 +576,6 @@ test(function consoleTable() { }); mockConsole((console, out) => { console.table("test"); - assertEqual(out.toString(), "test\n"); + assertEquals(out.toString(), "test\n"); }); }); diff --git a/js/copy_file_test.ts b/js/copy_file_test.ts index 5969cd22d6..33f8f027f3 100644 --- a/js/copy_file_test.ts +++ b/js/copy_file_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assert, assertEqual } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; function readFileString(filename: string): string { const dataRead = Deno.readFileSync(filename); @@ -16,7 +16,7 @@ function writeFileString(filename: string, s: string) { function assertSameContent(filename1: string, filename2: string) { const data1 = Deno.readFileSync(filename1); const data2 = Deno.readFileSync(filename2); - assertEqual(data1, data2); + assertEquals(data1, data2); } testPerm({ read: true, write: true }, function copyFileSyncSuccess() { @@ -26,7 +26,7 @@ testPerm({ read: true, write: true }, function copyFileSyncSuccess() { writeFileString(fromFilename, "Hello world!"); Deno.copyFileSync(fromFilename, toFilename); // No change to original file - assertEqual(readFileString(fromFilename), "Hello world!"); + assertEquals(readFileString(fromFilename), "Hello world!"); // Original == Dest assertSameContent(fromFilename, toFilename); }); @@ -43,8 +43,8 @@ testPerm({ write: true, read: true }, function copyFileSyncFailure() { err = e; } assert(!!err); - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: true, read: false }, function copyFileSyncPerm1() { @@ -53,8 +53,8 @@ testPerm({ write: true, read: false }, function copyFileSyncPerm1() { Deno.copyFileSync("/from.txt", "/to.txt"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -65,8 +65,8 @@ testPerm({ write: false, read: true }, function copyFileSyncPerm2() { Deno.copyFileSync("/from.txt", "/to.txt"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -80,7 +80,7 @@ testPerm({ read: true, write: true }, function copyFileSyncOverwrite() { writeFileString(toFilename, "Goodbye!"); Deno.copyFileSync(fromFilename, toFilename); // No change to original file - assertEqual(readFileString(fromFilename), "Hello world!"); + assertEquals(readFileString(fromFilename), "Hello world!"); // Original == Dest assertSameContent(fromFilename, toFilename); }); @@ -92,7 +92,7 @@ testPerm({ read: true, write: true }, async function copyFileSuccess() { writeFileString(fromFilename, "Hello world!"); await Deno.copyFile(fromFilename, toFilename); // No change to original file - assertEqual(readFileString(fromFilename), "Hello world!"); + assertEquals(readFileString(fromFilename), "Hello world!"); // Original == Dest assertSameContent(fromFilename, toFilename); }); @@ -109,8 +109,8 @@ testPerm({ read: true, write: true }, async function copyFileFailure() { err = e; } assert(!!err); - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ read: true, write: true }, async function copyFileOverwrite() { @@ -122,7 +122,7 @@ testPerm({ read: true, write: true }, async function copyFileOverwrite() { writeFileString(toFilename, "Goodbye!"); await Deno.copyFile(fromFilename, toFilename); // No change to original file - assertEqual(readFileString(fromFilename), "Hello world!"); + assertEquals(readFileString(fromFilename), "Hello world!"); // Original == Dest assertSameContent(fromFilename, toFilename); }); @@ -133,8 +133,8 @@ testPerm({ read: false, write: true }, async function copyFilePerm1() { await Deno.copyFile("/from.txt", "/to.txt"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -145,8 +145,8 @@ testPerm({ read: true, write: false }, async function copyFilePerm2() { await Deno.copyFile("/from.txt", "/to.txt"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); diff --git a/js/custom_event_test.ts b/js/custom_event_test.ts index 4a95727800..20c901303a 100644 --- a/js/custom_event_test.ts +++ b/js/custom_event_test.ts @@ -1,5 +1,5 @@ // Copyright 2018 the Deno authors. All rights reserved. MIT license. -import { test, assertEqual } from "./test_util.ts"; +import { test, assertEquals } from "./test_util.ts"; test(function customEventInitializedWithDetail() { const type = "touchstart"; @@ -11,11 +11,11 @@ test(function customEventInitializedWithDetail() { }); const event = new CustomEvent(type, customEventDict); - assertEqual(event.bubbles, true); - assertEqual(event.cancelable, true); - assertEqual(event.currentTarget, null); - assertEqual(event.detail, detail); - assertEqual(event.isTrusted, false); - assertEqual(event.target, null); - assertEqual(event.type, type); + assertEquals(event.bubbles, true); + assertEquals(event.cancelable, true); + assertEquals(event.currentTarget, null); + assertEquals(event.detail, detail); + assertEquals(event.isTrusted, false); + assertEquals(event.target, null); + assertEquals(event.type, type); }); diff --git a/js/deps/https/deno.land/std b/js/deps/https/deno.land/std index d441a7dbf0..4cf39d4a14 160000 --- a/js/deps/https/deno.land/std +++ b/js/deps/https/deno.land/std @@ -1 +1 @@ -Subproject commit d441a7dbf01ed87163dcde4120295c0c796f3f0d +Subproject commit 4cf39d4a1420b8153cd78d03d03ef843607ae506 diff --git a/js/dir_test.ts b/js/dir_test.ts index d2ddb137f3..bb6b053fdc 100644 --- a/js/dir_test.ts +++ b/js/dir_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, testPerm, assert, assertEqual } from "./test_util.ts"; +import { test, testPerm, assert, assertEquals } from "./test_util.ts"; test(function dirCwdNotNull() { assert(Deno.cwd() != null); @@ -11,9 +11,9 @@ testPerm({ write: true }, function dirCwdChdirSuccess() { Deno.chdir(path); const current = Deno.cwd(); if (Deno.build.os === "mac") { - assertEqual(current, "/private" + path); + assertEquals(current, "/private" + path); } else { - assertEqual(current, path); + assertEquals(current, path); } Deno.chdir(initialdir); }); diff --git a/js/event_target_test.ts b/js/event_target_test.ts index c6477f2c75..7837247958 100644 --- a/js/event_target_test.ts +++ b/js/event_target_test.ts @@ -1,12 +1,12 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assertEqual } from "./test_util.ts"; +import { test, assertEquals } from "./test_util.ts"; test(function addEventListenerTest() { const document = new EventTarget(); - assertEqual(document.addEventListener("x", null, false), undefined); - assertEqual(document.addEventListener("x", null, true), undefined); - assertEqual(document.addEventListener("x", null), undefined); + assertEquals(document.addEventListener("x", null, false), undefined); + assertEquals(document.addEventListener("x", null, true), undefined); + assertEquals(document.addEventListener("x", null), undefined); }); test(function constructedEventTargetCanBeUsedAsExpected() { @@ -15,21 +15,21 @@ test(function constructedEventTargetCanBeUsedAsExpected() { let callCount = 0; function listener(e) { - assertEqual(e, event); + assertEquals(e, event); ++callCount; } target.addEventListener("foo", listener); target.dispatchEvent(event); - assertEqual(callCount, 1); + assertEquals(callCount, 1); target.dispatchEvent(event); - assertEqual(callCount, 2); + assertEquals(callCount, 2); target.removeEventListener("foo", listener); target.dispatchEvent(event); - assertEqual(callCount, 2); + assertEquals(callCount, 2); }); test(function anEventTargetCanBeSubclassed() { @@ -52,15 +52,15 @@ test(function anEventTargetCanBeSubclassed() { } target.on("foo", listener); - assertEqual(callCount, 0); + assertEquals(callCount, 0); target.off("foo", listener); - assertEqual(callCount, 0); + assertEquals(callCount, 0); }); test(function removingNullEventListenerShouldSucceed() { const document = new EventTarget(); - assertEqual(document.removeEventListener("x", null, false), undefined); - assertEqual(document.removeEventListener("x", null, true), undefined); - assertEqual(document.removeEventListener("x", null), undefined); + assertEquals(document.removeEventListener("x", null, false), undefined); + assertEquals(document.removeEventListener("x", null, true), undefined); + assertEquals(document.removeEventListener("x", null), undefined); }); diff --git a/js/event_test.ts b/js/event_test.ts index 99b82a6be1..d0af40ea9f 100644 --- a/js/event_test.ts +++ b/js/event_test.ts @@ -1,16 +1,16 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assertEqual } from "./test_util.ts"; +import { test, assertEquals } from "./test_util.ts"; test(function eventInitializedWithType() { const type = "click"; const event = new Event(type); - assertEqual(event.isTrusted, false); - assertEqual(event.target, null); - assertEqual(event.currentTarget, null); - assertEqual(event.type, "click"); - assertEqual(event.bubbles, false); - assertEqual(event.cancelable, false); + assertEquals(event.isTrusted, false); + assertEquals(event.target, null); + assertEquals(event.currentTarget, null); + assertEquals(event.type, "click"); + assertEquals(event.bubbles, false); + assertEquals(event.cancelable, false); }); test(function eventInitializedWithTypeAndDict() { @@ -18,12 +18,12 @@ test(function eventInitializedWithTypeAndDict() { const eventInitDict = new EventInit({ bubbles: true, cancelable: true }); const event = new Event(init, eventInitDict); - assertEqual(event.isTrusted, false); - assertEqual(event.target, null); - assertEqual(event.currentTarget, null); - assertEqual(event.type, "submit"); - assertEqual(event.bubbles, true); - assertEqual(event.cancelable, true); + assertEquals(event.isTrusted, false); + assertEquals(event.target, null); + assertEquals(event.currentTarget, null); + assertEquals(event.type, "submit"); + assertEquals(event.bubbles, true); + assertEquals(event.cancelable, true); }); test(function eventComposedPathSuccess() { @@ -31,40 +31,40 @@ test(function eventComposedPathSuccess() { const event = new Event(type); const composedPath = event.composedPath(); - assertEqual(composedPath, []); + assertEquals(composedPath, []); }); test(function eventStopPropagationSuccess() { const type = "click"; const event = new Event(type); - assertEqual(event.cancelBubble, false); + assertEquals(event.cancelBubble, false); event.stopPropagation(); - assertEqual(event.cancelBubble, true); + assertEquals(event.cancelBubble, true); }); test(function eventStopImmediatePropagationSuccess() { const type = "click"; const event = new Event(type); - assertEqual(event.cancelBubble, false); - assertEqual(event.cancelBubbleImmediately, false); + assertEquals(event.cancelBubble, false); + assertEquals(event.cancelBubbleImmediately, false); event.stopImmediatePropagation(); - assertEqual(event.cancelBubble, true); - assertEqual(event.cancelBubbleImmediately, true); + assertEquals(event.cancelBubble, true); + assertEquals(event.cancelBubbleImmediately, true); }); test(function eventPreventDefaultSuccess() { const type = "click"; const event = new Event(type); - assertEqual(event.defaultPrevented, false); + assertEquals(event.defaultPrevented, false); event.preventDefault(); - assertEqual(event.defaultPrevented, false); + assertEquals(event.defaultPrevented, false); const eventInitDict = new EventInit({ bubbles: true, cancelable: true }); const cancelableEvent = new Event(type, eventInitDict); - assertEqual(cancelableEvent.defaultPrevented, false); + assertEquals(cancelableEvent.defaultPrevented, false); cancelableEvent.preventDefault(); - assertEqual(cancelableEvent.defaultPrevented, true); + assertEquals(cancelableEvent.defaultPrevented, true); }); diff --git a/js/fetch_test.ts b/js/fetch_test.ts index a931a26a4a..4197e9c712 100644 --- a/js/fetch_test.ts +++ b/js/fetch_test.ts @@ -1,10 +1,10 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, testPerm, assert, assertEqual } from "./test_util.ts"; +import { test, testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ net: true }, async function fetchJsonSuccess() { const response = await fetch("http://localhost:4545/package.json"); const json = await response.json(); - assertEqual(json.name, "deno"); + assertEquals(json.name, "deno"); }); test(async function fetchPerm() { @@ -14,14 +14,14 @@ test(async function fetchPerm() { } catch (err_) { err = err_; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); testPerm({ net: true }, async function fetchHeaders() { const response = await fetch("http://localhost:4545/package.json"); const headers = response.headers; - assertEqual(headers.get("Content-Type"), "application/json"); + assertEquals(headers.get("Content-Type"), "application/json"); assert(headers.get("Server").startsWith("SimpleHTTP")); }); @@ -29,20 +29,20 @@ testPerm({ net: true }, async function fetchBlob() { const response = await fetch("http://localhost:4545/package.json"); const headers = response.headers; const blob = await response.blob(); - assertEqual(blob.type, headers.get("Content-Type")); - assertEqual(blob.size, Number(headers.get("Content-Length"))); + assertEquals(blob.type, headers.get("Content-Type")); + assertEquals(blob.size, Number(headers.get("Content-Length"))); }); testPerm({ net: true }, async function responseClone() { const response = await fetch("http://localhost:4545/package.json"); const response1 = response.clone(); assert(response !== response1); - assertEqual(response.status, response1.status); - assertEqual(response.statusText, response1.statusText); + assertEquals(response.status, response1.status); + assertEquals(response.statusText, response1.statusText); const ab = await response.arrayBuffer(); const ab1 = await response1.arrayBuffer(); for (let i = 0; i < ab.byteLength; i++) { - assertEqual(ab[i], ab1[i]); + assertEquals(ab[i], ab1[i]); } }); @@ -53,8 +53,8 @@ testPerm({ net: true }, async function fetchEmptyInvalid() { } catch (err_) { err = err_; } - assertEqual(err.kind, Deno.ErrorKind.InvalidUri); - assertEqual(err.name, "InvalidUri"); + assertEquals(err.kind, Deno.ErrorKind.InvalidUri); + assertEquals(err.name, "InvalidUri"); }); testPerm({ net: true }, async function fetchMultipartFormDataSuccess() { @@ -63,11 +63,11 @@ testPerm({ net: true }, async function fetchMultipartFormDataSuccess() { ); const formData = await response.formData(); assert(formData.has("field_1")); - assertEqual(formData.get("field_1").toString(), "value_1 \r\n"); + assertEquals(formData.get("field_1").toString(), "value_1 \r\n"); assert(formData.has("field_2")); /* TODO(ry) Re-enable this test once we bring back the global File type. const file = formData.get("field_2") as File; - assertEqual(file.name, "file.js"); + assertEquals(file.name, "file.js"); */ // Currently we cannot read from file... }); @@ -78,9 +78,9 @@ testPerm({ net: true }, async function fetchURLEncodedFormDataSuccess() { ); const formData = await response.formData(); assert(formData.has("field_1")); - assertEqual(formData.get("field_1").toString(), "Hi"); + assertEquals(formData.get("field_1").toString(), "Hi"); assert(formData.has("field_2")); - assertEqual(formData.get("field_2").toString(), ""); + assertEquals(formData.get("field_2").toString(), ""); }); testPerm({ net: true }, async function fetchInitStringBody() { @@ -90,7 +90,7 @@ testPerm({ net: true }, async function fetchInitStringBody() { body: data }); const text = await response.text(); - assertEqual(text, data); + assertEquals(text, data); assert(response.headers.get("content-type").startsWith("text/plain")); }); @@ -101,7 +101,7 @@ testPerm({ net: true }, async function fetchInitTypedArrayBody() { body: new TextEncoder().encode(data) }); const text = await response.text(); - assertEqual(text, data); + assertEquals(text, data); }); testPerm({ net: true }, async function fetchInitURLSearchParamsBody() { @@ -112,7 +112,7 @@ testPerm({ net: true }, async function fetchInitURLSearchParamsBody() { body: params }); const text = await response.text(); - assertEqual(text, data); + assertEquals(text, data); assert( response.headers .get("content-type") @@ -130,7 +130,7 @@ testPerm({ net: true }, async function fetchInitBlobBody() { body: blob }); const text = await response.text(); - assertEqual(text, data); + assertEquals(text, data); assert(response.headers.get("content-type").startsWith("text/javascript")); }); @@ -138,7 +138,7 @@ testPerm({ net: true }, async function fetchInitBlobBody() { // somewhere. Here is what one of these flaky failures looks like: // // test fetchPostBodyString_permW0N1E0R0 -// assertEqual failed. actual = expected = POST /blah HTTP/1.1 +// assertEquals failed. actual = expected = POST /blah HTTP/1.1 // hello: World // foo: Bar // host: 127.0.0.1:4502 @@ -150,7 +150,7 @@ testPerm({ net: true }, async function fetchInitBlobBody() { // host: 127.0.0.1:4502 // content-length: 11 // hello world -// at Object.assertEqual (file:///C:/deno/js/testing/util.ts:29:11) +// at Object.assertEquals (file:///C:/deno/js/testing/util.ts:29:11) // at fetchPostBodyString (file /* @@ -184,8 +184,8 @@ testPerm({ net: true }, async function fetchRequest() { method: "POST", headers: [["Hello", "World"], ["Foo", "Bar"]] }); - assertEqual(response.status, 404); - assertEqual(response.headers.get("Content-Length"), "2"); + assertEquals(response.status, 404); + assertEquals(response.headers.get("Content-Length"), "2"); const actual = new TextDecoder().decode(buf.bytes()); const expected = [ @@ -194,7 +194,7 @@ testPerm({ net: true }, async function fetchRequest() { "foo: Bar\r\n", `host: ${addr}\r\n\r\n` ].join(""); - assertEqual(actual, expected); + assertEquals(actual, expected); }); testPerm({ net: true }, async function fetchPostBodyString() { @@ -206,8 +206,8 @@ testPerm({ net: true }, async function fetchPostBodyString() { headers: [["Hello", "World"], ["Foo", "Bar"]], body }); - assertEqual(response.status, 404); - assertEqual(response.headers.get("Content-Length"), "2"); + assertEquals(response.status, 404); + assertEquals(response.headers.get("Content-Length"), "2"); const actual = new TextDecoder().decode(buf.bytes()); const expected = [ @@ -218,7 +218,7 @@ testPerm({ net: true }, async function fetchPostBodyString() { `content-length: ${body.length}\r\n\r\n`, body ].join(""); - assertEqual(actual, expected); + assertEquals(actual, expected); }); testPerm({ net: true }, async function fetchPostBodyTypedArray() { @@ -231,8 +231,8 @@ testPerm({ net: true }, async function fetchPostBodyTypedArray() { headers: [["Hello", "World"], ["Foo", "Bar"]], body }); - assertEqual(response.status, 404); - assertEqual(response.headers.get("Content-Length"), "2"); + assertEquals(response.status, 404); + assertEquals(response.headers.get("Content-Length"), "2"); const actual = new TextDecoder().decode(buf.bytes()); const expected = [ @@ -243,6 +243,6 @@ testPerm({ net: true }, async function fetchPostBodyTypedArray() { `content-length: ${body.byteLength}\r\n\r\n`, bodyStr ].join(""); - assertEqual(actual, expected); + assertEquals(actual, expected); }); */ diff --git a/js/file_test.ts b/js/file_test.ts index 37d22709a8..77320c1137 100644 --- a/js/file_test.ts +++ b/js/file_test.ts @@ -1,12 +1,12 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assert, assertEqual } from "./test_util.ts"; +import { test, assert, assertEquals } from "./test_util.ts"; function testFirstArgument(arg1, expectedSize) { const file = new File(arg1, "name"); assert(file instanceof File); - assertEqual(file.name, "name"); - assertEqual(file.size, expectedSize); - assertEqual(file.type, ""); + assertEquals(file.name, "name"); + assertEquals(file.size, expectedSize); + assertEquals(file.type, ""); } test(function fileEmptyFileBits() { @@ -80,7 +80,7 @@ test(function fileObjectInFileBits() { function testSecondArgument(arg2, expectedFileName) { const file = new File(["bits"], arg2); assert(file instanceof File); - assertEqual(file.name, expectedFileName); + assertEquals(file.name, expectedFileName); } test(function fileUsingFileName() { diff --git a/js/files_test.ts b/js/files_test.ts index 5d23cff528..7e5bbf5f02 100644 --- a/js/files_test.ts +++ b/js/files_test.ts @@ -1,10 +1,10 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, testPerm, assert, assertEqual } from "./test_util.ts"; +import { test, testPerm, assert, assertEquals } from "./test_util.ts"; test(function filesStdioFileDescriptors() { - assertEqual(Deno.stdin.rid, 0); - assertEqual(Deno.stdout.rid, 1); - assertEqual(Deno.stderr.rid, 2); + assertEquals(Deno.stdin.rid, 0); + assertEquals(Deno.stdout.rid, 1); + assertEquals(Deno.stderr.rid, 2); }); testPerm({ read: true }, async function filesCopyToStdout() { @@ -13,7 +13,7 @@ testPerm({ read: true }, async function filesCopyToStdout() { assert(file.rid > 2); const bytesWritten = await Deno.copy(Deno.stdout, file); const fileSize = Deno.statSync(filename).len; - assertEqual(bytesWritten, fileSize); + assertEquals(bytesWritten, fileSize); console.log("bytes written", bytesWritten); }); @@ -26,7 +26,7 @@ testPerm({ read: true }, async function filesToAsyncIterator() { totalSize += buf.byteLength; } - assertEqual(totalSize, 12); + assertEquals(totalSize, 12); }); testPerm({ write: false }, async function writePermFailure() { @@ -40,8 +40,8 @@ testPerm({ write: false }, async function writePermFailure() { err = e; } assert(!!err); - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); } }); @@ -51,8 +51,8 @@ testPerm({ read: false }, async function readPermFailure() { await Deno.open("package.json", "r"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -68,8 +68,8 @@ testPerm({ write: false, read: false }, async function readWritePermFailure() { err = e; } assert(!!err); - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); } }); @@ -101,11 +101,11 @@ testPerm({ read: true, write: true }, async function openModeWrite() { // assert file was created let fileInfo = Deno.statSync(filename); assert(fileInfo.isFile()); - assertEqual(fileInfo.len, 0); + assertEquals(fileInfo.len, 0); // write some data await file.write(data); fileInfo = Deno.statSync(filename); - assertEqual(fileInfo.len, 13); + assertEquals(fileInfo.len, 13); // assert we can't read from file let thrown = false; try { @@ -121,7 +121,7 @@ testPerm({ read: true, write: true }, async function openModeWrite() { file = await Deno.open(filename, "w"); file.close(); const fileSize = Deno.statSync(filename).len; - assertEqual(fileSize, 0); + assertEquals(fileSize, 0); await Deno.remove(tempDir, { recursive: true }); }); @@ -135,16 +135,16 @@ testPerm({ read: true, write: true }, async function openModeWriteRead() { // assert file was created let fileInfo = Deno.statSync(filename); assert(fileInfo.isFile()); - assertEqual(fileInfo.len, 0); + assertEquals(fileInfo.len, 0); // write some data await file.write(data); fileInfo = Deno.statSync(filename); - assertEqual(fileInfo.len, 13); + assertEquals(fileInfo.len, 13); const buf = new Uint8Array(20); await file.seek(0, Deno.SeekMode.SEEK_START); const result = await file.read(buf); - assertEqual(result.nread, 13); + assertEquals(result.nread, 13); file.close(); await Deno.remove(tempDir, { recursive: true }); @@ -160,7 +160,7 @@ testPerm({ read: true }, async function seekStart() { const buf = new Uint8Array(6); await file.read(buf); const decoded = new TextDecoder().decode(buf); - assertEqual(decoded, "world!"); + assertEquals(decoded, "world!"); }); testPerm({ read: true }, async function seekCurrent() { @@ -173,7 +173,7 @@ testPerm({ read: true }, async function seekCurrent() { const buf = new Uint8Array(6); await file.read(buf); const decoded = new TextDecoder().decode(buf); - assertEqual(decoded, "world!"); + assertEquals(decoded, "world!"); }); testPerm({ read: true }, async function seekEnd() { @@ -183,7 +183,7 @@ testPerm({ read: true }, async function seekEnd() { const buf = new Uint8Array(6); await file.read(buf); const decoded = new TextDecoder().decode(buf); - assertEqual(decoded, "world!"); + assertEquals(decoded, "world!"); }); testPerm({ read: true }, async function seekMode() { @@ -196,6 +196,6 @@ testPerm({ read: true }, async function seekMode() { err = e; } assert(!!err); - assertEqual(err.kind, Deno.ErrorKind.InvalidSeekMode); - assertEqual(err.name, "InvalidSeekMode"); + assertEquals(err.kind, Deno.ErrorKind.InvalidSeekMode); + assertEquals(err.name, "InvalidSeekMode"); }); diff --git a/js/form_data_test.ts b/js/form_data_test.ts index 9edd00549d..02e2c989ac 100644 --- a/js/form_data_test.ts +++ b/js/form_data_test.ts @@ -1,24 +1,24 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assert, assertEqual } from "./test_util.ts"; +import { test, assert, assertEquals } from "./test_util.ts"; test(function formDataHasCorrectNameProp() { - assertEqual(FormData.name, "FormData"); + assertEquals(FormData.name, "FormData"); }); test(function formDataParamsAppendSuccess() { const formData = new FormData(); formData.append("a", "true"); - assertEqual(formData.get("a"), "true"); + assertEquals(formData.get("a"), "true"); }); test(function formDataParamsDeleteSuccess() { const formData = new FormData(); formData.append("a", "true"); formData.append("b", "false"); - assertEqual(formData.get("b"), "false"); + assertEquals(formData.get("b"), "false"); formData.delete("b"); - assertEqual(formData.get("a"), "true"); - assertEqual(formData.get("b"), null); + assertEquals(formData.get("a"), "true"); + assertEquals(formData.get("b"), null); }); test(function formDataParamsGetAllSuccess() { @@ -26,9 +26,9 @@ test(function formDataParamsGetAllSuccess() { formData.append("a", "true"); formData.append("b", "false"); formData.append("a", "null"); - assertEqual(formData.getAll("a"), ["true", "null"]); - assertEqual(formData.getAll("b"), ["false"]); - assertEqual(formData.getAll("c"), []); + assertEquals(formData.getAll("a"), ["true", "null"]); + assertEquals(formData.getAll("b"), ["false"]); + assertEquals(formData.getAll("c"), []); }); test(function formDataParamsGetSuccess() { @@ -38,11 +38,11 @@ test(function formDataParamsGetSuccess() { formData.append("a", "null"); formData.append("d", undefined); formData.append("e", null); - assertEqual(formData.get("a"), "true"); - assertEqual(formData.get("b"), "false"); - assertEqual(formData.get("c"), null); - assertEqual(formData.get("d"), "undefined"); - assertEqual(formData.get("e"), "null"); + assertEquals(formData.get("a"), "true"); + assertEquals(formData.get("b"), "false"); + assertEquals(formData.get("c"), null); + assertEquals(formData.get("d"), "undefined"); + assertEquals(formData.get("e"), "null"); }); test(function formDataParamsHasSuccess() { @@ -59,14 +59,14 @@ test(function formDataParamsSetSuccess() { formData.append("a", "true"); formData.append("b", "false"); formData.append("a", "null"); - assertEqual(formData.getAll("a"), ["true", "null"]); - assertEqual(formData.getAll("b"), ["false"]); + assertEquals(formData.getAll("a"), ["true", "null"]); + assertEquals(formData.getAll("b"), ["false"]); formData.set("a", "false"); - assertEqual(formData.getAll("a"), ["false"]); + assertEquals(formData.getAll("a"), ["false"]); formData.set("d", undefined); - assertEqual(formData.get("d"), "undefined"); + assertEquals(formData.get("d"), "undefined"); formData.set("e", null); - assertEqual(formData.get("e"), "null"); + assertEquals(formData.get("e"), "null"); }); test(function formDataSetEmptyBlobSuccess() { @@ -76,7 +76,7 @@ test(function formDataSetEmptyBlobSuccess() { /* TODO Fix this test. assert(file instanceof File); if (typeof file !== "string") { - assertEqual(file.name, "blank.txt"); + assertEquals(file.name, "blank.txt"); } */ }); @@ -89,12 +89,12 @@ test(function formDataParamsForEachSuccess() { } let callNum = 0; formData.forEach((value, key, parent) => { - assertEqual(formData, parent); - assertEqual(value, init[callNum][1]); - assertEqual(key, init[callNum][0]); + assertEquals(formData, parent); + assertEquals(value, init[callNum][1]); + assertEquals(key, init[callNum][0]); callNum++; }); - assertEqual(callNum, init.length); + assertEquals(callNum, init.length); }); test(function formDataParamsArgumentsCheck() { @@ -117,8 +117,8 @@ test(function formDataParamsArgumentsCheck() { hasThrown = 3; } } - assertEqual(hasThrown, 2); - assertEqual( + assertEquals(hasThrown, 2); + assertEquals( errMsg, `FormData.${method} requires at least 1 argument, but only 0 present` ); @@ -140,8 +140,8 @@ test(function formDataParamsArgumentsCheck() { hasThrown = 3; } } - assertEqual(hasThrown, 2); - assertEqual( + assertEquals(hasThrown, 2); + assertEquals( errMsg, `FormData.${method} requires at least 2 arguments, but only 0 present` ); @@ -159,8 +159,8 @@ test(function formDataParamsArgumentsCheck() { hasThrown = 3; } } - assertEqual(hasThrown, 2); - assertEqual( + assertEquals(hasThrown, 2); + assertEquals( errMsg, `FormData.${method} requires at least 2 arguments, but only 1 present` ); diff --git a/js/headers_test.ts b/js/headers_test.ts index 27074cc8b1..223e08dafb 100644 --- a/js/headers_test.ts +++ b/js/headers_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assert, assertEqual } from "./test_util.ts"; +import { test, assert, assertEquals } from "./test_util.ts"; // Logic heavily copied from web-platform-tests, make // sure pass mostly header basic test @@ -13,7 +13,7 @@ test(function newHeaderTest() { try { new Headers(null); } catch (e) { - assertEqual( + assertEquals( e.message, "Failed to construct 'Headers'; The provided value was not valid" ); @@ -35,15 +35,15 @@ for (const name in headerDict) { test(function newHeaderWithSequence() { const headers = new Headers(headerSeq); for (const name in headerDict) { - assertEqual(headers.get(name), String(headerDict[name])); + assertEquals(headers.get(name), String(headerDict[name])); } - assertEqual(headers.get("length"), null); + assertEquals(headers.get("length"), null); }); test(function newHeaderWithRecord() { const headers = new Headers(headerDict); for (const name in headerDict) { - assertEqual(headers.get(name), String(headerDict[name])); + assertEquals(headers.get(name), String(headerDict[name])); } }); @@ -51,7 +51,7 @@ test(function newHeaderWithHeadersInstance() { const headers = new Headers(headerDict); const headers2 = new Headers(headers); for (const name in headerDict) { - assertEqual(headers2.get(name), String(headerDict[name])); + assertEquals(headers2.get(name), String(headerDict[name])); } }); @@ -59,7 +59,7 @@ test(function headerAppendSuccess() { const headers = new Headers(); for (const name in headerDict) { headers.append(name, headerDict[name]); - assertEqual(headers.get(name), String(headerDict[name])); + assertEquals(headers.get(name), String(headerDict[name])); } }); @@ -67,7 +67,7 @@ test(function headerSetSuccess() { const headers = new Headers(); for (const name in headerDict) { headers.set(name, headerDict[name]); - assertEqual(headers.get(name), String(headerDict[name])); + assertEquals(headers.get(name), String(headerDict[name])); } }); @@ -95,8 +95,8 @@ test(function headerDeleteSuccess() { test(function headerGetSuccess() { const headers = new Headers(headerDict); for (const name in headerDict) { - assertEqual(headers.get(name), String(headerDict[name])); - assertEqual(headers.get("nameNotInHeaders"), null); + assertEquals(headers.get(name), String(headerDict[name])); + assertEquals(headers.get("nameNotInHeaders"), null); } }); @@ -107,7 +107,7 @@ test(function headerEntriesSuccess() { const key = it[0]; const value = it[1]; assert(headers.has(key)); - assertEqual(value, headers.get(key)); + assertEquals(value, headers.get(key)); } }); @@ -151,11 +151,11 @@ test(function headerForEachSuccess() { }); let callNum = 0; headers.forEach((value, key, container) => { - assertEqual(headers, container); - assertEqual(value, headerEntriesDict[key]); + assertEquals(headers, container); + assertEquals(value, headerEntriesDict[key]); callNum++; }); - assertEqual(callNum, keys.length); + assertEquals(callNum, keys.length); }); test(function headerSymbolIteratorSuccess() { @@ -165,7 +165,7 @@ test(function headerSymbolIteratorSuccess() { const key = header[0]; const value = header[1]; assert(headers.has(key)); - assertEqual(value, headers.get(key)); + assertEquals(value, headers.get(key)); } }); @@ -228,7 +228,7 @@ test(function headerIllegalReject() { } catch (e) { errorCount++; } - assertEqual(errorCount, 9); + assertEquals(errorCount, 9); // 'o k' is valid value but invalid name new Headers({ "He-y": "o k" }); }); @@ -248,7 +248,7 @@ test(function headerParamsShouldThrowTypeError() { } } - assertEqual(hasThrown, 2); + assertEquals(hasThrown, 2); }); test(function headerParamsArgumentsCheck() { @@ -271,8 +271,8 @@ test(function headerParamsArgumentsCheck() { hasThrown = 3; } } - assertEqual(hasThrown, 2); - assertEqual( + assertEquals(hasThrown, 2); + assertEquals( errMsg, `Headers.${method} requires at least 1 argument, but only 0 present` ); @@ -294,8 +294,8 @@ test(function headerParamsArgumentsCheck() { hasThrown = 3; } } - assertEqual(hasThrown, 2); - assertEqual( + assertEquals(hasThrown, 2); + assertEquals( errMsg, `Headers.${method} requires at least 2 arguments, but only 0 present` ); @@ -313,8 +313,8 @@ test(function headerParamsArgumentsCheck() { hasThrown = 3; } } - assertEqual(hasThrown, 2); - assertEqual( + assertEquals(hasThrown, 2); + assertEquals( errMsg, `Headers.${method} requires at least 2 arguments, but only 1 present` ); diff --git a/js/make_temp_dir_test.ts b/js/make_temp_dir_test.ts index 2b593402f5..46738617df 100644 --- a/js/make_temp_dir_test.ts +++ b/js/make_temp_dir_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, testPerm, assert, assertEqual } from "./test_util.ts"; +import { test, testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ write: true }, function makeTempDirSyncSuccess() { const dir1 = Deno.makeTempDirSync({ prefix: "hello", suffix: "world" }); @@ -23,8 +23,8 @@ testPerm({ write: true }, function makeTempDirSyncSuccess() { } catch (err_) { err = err_; } - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); test(function makeTempDirSyncPerm() { @@ -35,8 +35,8 @@ test(function makeTempDirSyncPerm() { } catch (err_) { err = err_; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); testPerm({ write: true }, async function makeTempDirSuccess() { @@ -61,6 +61,6 @@ testPerm({ write: true }, async function makeTempDirSuccess() { } catch (err_) { err = err_; } - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); diff --git a/js/mixins/dom_iterable_test.ts b/js/mixins/dom_iterable_test.ts index 863891f51e..a0bed7bd30 100644 --- a/js/mixins/dom_iterable_test.ts +++ b/js/mixins/dom_iterable_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assert, assertEqual } from "../test_util.ts"; +import { test, assert, assertEquals } from "../test_util.ts"; function setup() { const dataSymbol = Symbol("data symbol"); @@ -32,9 +32,9 @@ test(function testDomIterable() { const domIterable = new DomIterable(fixture); - assertEqual(Array.from(domIterable.entries()), fixture); - assertEqual(Array.from(domIterable.values()), [1, 2]); - assertEqual(Array.from(domIterable.keys()), ["foo", "bar"]); + assertEquals(Array.from(domIterable.entries()), fixture); + assertEquals(Array.from(domIterable.values()), [1, 2]); + assertEquals(Array.from(domIterable.keys()), ["foo", "bar"]); let result: Array<[string, number]> = []; for (const [key, value] of domIterable) { @@ -42,21 +42,21 @@ test(function testDomIterable() { assert(value != null); result.push([key, value]); } - assertEqual(fixture, result); + assertEquals(fixture, result); result = []; const scope = {}; function callback(value, key, parent) { - assertEqual(parent, domIterable); + assertEquals(parent, domIterable); assert(key != null); assert(value != null); assert(this === scope); result.push([key, value]); } domIterable.forEach(callback, scope); - assertEqual(fixture, result); + assertEquals(fixture, result); - assertEqual(DomIterable.name, Base.name); + assertEquals(DomIterable.name, Base.name); }); test(function testDomIterableScope() { @@ -68,7 +68,7 @@ test(function testDomIterableScope() { // tslint:disable-next-line:no-any function checkScope(thisArg: any, expected: any) { function callback() { - assertEqual(this, expected); + assertEquals(this, expected); } domIterable.forEach(callback, thisArg); } diff --git a/js/mkdir_test.ts b/js/mkdir_test.ts index df74ee9435..2d4f951aa2 100644 --- a/js/mkdir_test.ts +++ b/js/mkdir_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assert, assertEqual } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ read: true, write: true }, function mkdirSyncSuccess() { const path = Deno.makeTempDirSync() + "/dir"; @@ -14,7 +14,7 @@ testPerm({ read: true, write: true }, function mkdirSyncMode() { const pathInfo = Deno.statSync(path); if (pathInfo.mode !== null) { // Skip windows - assertEqual(pathInfo.mode & 0o777, 0o755); + assertEquals(pathInfo.mode & 0o777, 0o755); } }); @@ -25,8 +25,8 @@ testPerm({ write: false }, function mkdirSyncPerm() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); testPerm({ read: true, write: true }, async function mkdirSuccess() { @@ -43,8 +43,8 @@ testPerm({ write: true }, function mkdirErrIfExists() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.AlreadyExists); - assertEqual(err.name, "AlreadyExists"); + assertEquals(err.kind, Deno.ErrorKind.AlreadyExists); + assertEquals(err.name, "AlreadyExists"); }); testPerm({ read: true, write: true }, function mkdirSyncRecursive() { diff --git a/js/net_test.ts b/js/net_test.ts index f20bb9ddb0..5b8b80bea2 100644 --- a/js/net_test.ts +++ b/js/net_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assert, assertEqual } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ net: true }, function netListenClose() { const listener = Deno.listen("tcp", "127.0.0.1:4500"); @@ -17,17 +17,17 @@ testPerm({ net: true }, async function netCloseWhileAccept() { err = e; } assert(!!err); - assertEqual(err.kind, Deno.ErrorKind.Other); - assertEqual(err.message, "Listener has been closed"); + assertEquals(err.kind, Deno.ErrorKind.Other); + assertEquals(err.message, "Listener has been closed"); }); testPerm({ net: true }, async function netConcurrentAccept() { const listener = Deno.listen("tcp", ":4502"); let acceptErrCount = 0; const checkErr = e => { - assertEqual(e.kind, Deno.ErrorKind.Other); + assertEquals(e.kind, Deno.ErrorKind.Other); if (e.message === "Listener has been closed") { - assertEqual(acceptErrCount, 1); + assertEquals(acceptErrCount, 1); } else if (e.message === "Another accept task is ongoing") { acceptErrCount++; } else { @@ -39,7 +39,7 @@ testPerm({ net: true }, async function netConcurrentAccept() { await Promise.race([p, p1]); listener.close(); await [p, p1]; - assertEqual(acceptErrCount, 1); + assertEquals(acceptErrCount, 1); }); testPerm({ net: true }, async function netDialListen() { @@ -51,20 +51,20 @@ testPerm({ net: true }, async function netDialListen() { const conn = await Deno.dial("tcp", "127.0.0.1:4500"); const buf = new Uint8Array(1024); const readResult = await conn.read(buf); - assertEqual(3, readResult.nread); - assertEqual(1, buf[0]); - assertEqual(2, buf[1]); - assertEqual(3, buf[2]); + assertEquals(3, readResult.nread); + assertEquals(1, buf[0]); + assertEquals(2, buf[1]); + assertEquals(3, buf[2]); assert(conn.rid > 0); // TODO Currently ReadResult does not properly transmit EOF in the same call. // it requires a second call to get the EOF. Either ReadResult to be an // integer in which 0 signifies EOF or the handler should be modified so that // EOF is properly transmitted. - assertEqual(false, readResult.eof); + assertEquals(false, readResult.eof); const readResult2 = await conn.read(buf); - assertEqual(true, readResult2.eof); + assertEquals(true, readResult2.eof); listener.close(); conn.close(); @@ -81,10 +81,10 @@ testPerm({ net: true }, async function netCloseReadSuccess() { await conn.write(new Uint8Array([1, 2, 3])); const buf = new Uint8Array(1024); const readResult = await conn.read(buf); - assertEqual(3, readResult.nread); - assertEqual(4, buf[0]); - assertEqual(5, buf[1]); - assertEqual(6, buf[2]); + assertEquals(3, readResult.nread); + assertEquals(4, buf[0]); + assertEquals(5, buf[1]); + assertEquals(6, buf[2]); conn.close(); closeDeferred.resolve(); }); @@ -93,8 +93,8 @@ testPerm({ net: true }, async function netCloseReadSuccess() { closeReadDeferred.resolve(); const buf = new Uint8Array(1024); const readResult = await conn.read(buf); - assertEqual(0, readResult.nread); // No error, read nothing - assertEqual(true, readResult.eof); // with immediate EOF + assertEquals(0, readResult.nread); // No error, read nothing + assertEquals(true, readResult.eof); // with immediate EOF // Ensure closeRead does not impact write await conn.write(new Uint8Array([4, 5, 6])); await closeDeferred.promise; @@ -123,8 +123,8 @@ testPerm({ net: true }, async function netDoubleCloseRead() { err = e; } assert(!!err); - assertEqual(err.kind, Deno.ErrorKind.NotConnected); - assertEqual(err.name, "NotConnected"); + assertEquals(err.kind, Deno.ErrorKind.NotConnected); + assertEquals(err.name, "NotConnected"); closeDeferred.resolve(); listener.close(); conn.close(); @@ -146,10 +146,10 @@ testPerm({ net: true }, async function netCloseWriteSuccess() { const buf = new Uint8Array(1024); // Check read not impacted const readResult = await conn.read(buf); - assertEqual(3, readResult.nread); - assertEqual(1, buf[0]); - assertEqual(2, buf[1]); - assertEqual(3, buf[2]); + assertEquals(3, readResult.nread); + assertEquals(1, buf[0]); + assertEquals(2, buf[1]); + assertEquals(3, buf[2]); // Check write should be closed let err; try { @@ -158,8 +158,8 @@ testPerm({ net: true }, async function netCloseWriteSuccess() { err = e; } assert(!!err); - assertEqual(err.kind, Deno.ErrorKind.BrokenPipe); - assertEqual(err.name, "BrokenPipe"); + assertEquals(err.kind, Deno.ErrorKind.BrokenPipe); + assertEquals(err.name, "BrokenPipe"); closeDeferred.resolve(); listener.close(); conn.close(); @@ -185,8 +185,8 @@ testPerm({ net: true }, async function netDoubleCloseWrite() { err = e; } assert(!!err); - assertEqual(err.kind, Deno.ErrorKind.NotConnected); - assertEqual(err.name, "NotConnected"); + assertEquals(err.kind, Deno.ErrorKind.NotConnected); + assertEquals(err.name, "NotConnected"); closeDeferred.resolve(); listener.close(); conn.close(); diff --git a/js/os_test.ts b/js/os_test.ts index c37a9a1ea7..0773bf685b 100644 --- a/js/os_test.ts +++ b/js/os_test.ts @@ -1,12 +1,12 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, testPerm, assert, assertEqual } from "./test_util.ts"; +import { test, testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ env: true }, function envSuccess() { const env = Deno.env(); assert(env !== null); env.test_var = "Hello World"; const newEnv = Deno.env(); - assertEqual(env.test_var, newEnv.test_var); + assertEquals(env.test_var, newEnv.test_var); }); test(function envFailure() { @@ -15,8 +15,8 @@ test(function envFailure() { const env = Deno.env(); } catch (err) { caughtError = true; - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); } assert(caughtError); diff --git a/js/permissions_test.ts b/js/permissions_test.ts index f4245c03b7..21c21aa941 100644 --- a/js/permissions_test.ts +++ b/js/permissions_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assert, assertEqual } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; import { Permission } from "deno"; const knownPermissions: Permission[] = ["run", "read", "write", "net", "env"]; @@ -9,14 +9,14 @@ for (let grant of knownPermissions) { const perms = Deno.permissions(); assert(perms !== null); for (const perm in perms) { - assertEqual(perms[perm], perm === grant); + assertEquals(perms[perm], perm === grant); } Deno.revokePermission(grant); const revoked = Deno.permissions(); for (const perm in revoked) { - assertEqual(revoked[perm], false); + assertEquals(revoked[perm], false); } }); } diff --git a/js/process_test.ts b/js/process_test.ts index 6613ff1026..b442f0092a 100644 --- a/js/process_test.ts +++ b/js/process_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, testPerm, assert, assertEqual } from "./test_util.ts"; +import { test, testPerm, assert, assertEquals } from "./test_util.ts"; const { run, DenoError, ErrorKind } = Deno; test(function runPermissions() { @@ -8,8 +8,8 @@ test(function runPermissions() { Deno.run({ args: ["python", "-c", "print('hello world')"] }); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -20,9 +20,9 @@ testPerm({ run: true }, async function runSuccess() { }); const status = await p.status(); console.log("status", status); - assertEqual(status.success, true); - assertEqual(status.code, 0); - assertEqual(status.signal, undefined); + assertEquals(status.success, true); + assertEquals(status.code, 0); + assertEquals(status.signal, undefined); p.close(); }); @@ -31,9 +31,9 @@ testPerm({ run: true }, async function runCommandFailedWithCode() { args: ["python", "-c", "import sys;sys.exit(41 + 1)"] }); let status = await p.status(); - assertEqual(status.success, false); - assertEqual(status.code, 42); - assertEqual(status.signal, undefined); + assertEquals(status.success, false); + assertEquals(status.code, 42); + assertEquals(status.signal, undefined); p.close(); }); @@ -45,9 +45,9 @@ testPerm({ run: true }, async function runCommandFailedWithSignal() { args: ["python", "-c", "import os;os.kill(os.getpid(), 9)"] }); const status = await p.status(); - assertEqual(status.success, false); - assertEqual(status.code, undefined); - assertEqual(status.signal, 9); + assertEquals(status.success, false); + assertEquals(status.code, undefined); + assertEquals(status.signal, 9); p.close(); }); @@ -60,7 +60,7 @@ testPerm({ run: true }, function runNotFound() { } assert(error !== undefined); assert(error instanceof DenoError); - assertEqual(error.kind, ErrorKind.NotFound); + assertEquals(error.kind, ErrorKind.NotFound); }); testPerm({ write: true, run: true }, async function runWithCwdIsAsync() { @@ -97,9 +97,9 @@ while True: Deno.writeFileSync(`${cwd}/${exitCodeFile}`, enc.encode(`${code}`)); const status = await p.status(); - assertEqual(status.success, false); - assertEqual(status.code, code); - assertEqual(status.signal, undefined); + assertEquals(status.success, false); + assertEquals(status.code, code); + assertEquals(status.signal, undefined); p.close(); }); @@ -113,14 +113,14 @@ testPerm({ run: true }, async function runStdinPiped() { let msg = new TextEncoder().encode("hello"); let n = await p.stdin.write(msg); - assertEqual(n, msg.byteLength); + assertEquals(n, msg.byteLength); p.stdin.close(); const status = await p.status(); - assertEqual(status.success, true); - assertEqual(status.code, 0); - assertEqual(status.signal, undefined); + assertEquals(status.success, true); + assertEquals(status.code, 0); + assertEquals(status.signal, undefined); p.close(); }); @@ -134,19 +134,19 @@ testPerm({ run: true }, async function runStdoutPiped() { const data = new Uint8Array(10); let r = await p.stdout.read(data); - assertEqual(r.nread, 5); - assertEqual(r.eof, false); + assertEquals(r.nread, 5); + assertEquals(r.eof, false); const s = new TextDecoder().decode(data.subarray(0, r.nread)); - assertEqual(s, "hello"); + assertEquals(s, "hello"); r = await p.stdout.read(data); - assertEqual(r.nread, 0); - assertEqual(r.eof, true); + assertEquals(r.nread, 0); + assertEquals(r.eof, true); p.stdout.close(); const status = await p.status(); - assertEqual(status.success, true); - assertEqual(status.code, 0); - assertEqual(status.signal, undefined); + assertEquals(status.success, true); + assertEquals(status.code, 0); + assertEquals(status.signal, undefined); p.close(); }); @@ -160,19 +160,19 @@ testPerm({ run: true }, async function runStderrPiped() { const data = new Uint8Array(10); let r = await p.stderr.read(data); - assertEqual(r.nread, 5); - assertEqual(r.eof, false); + assertEquals(r.nread, 5); + assertEquals(r.eof, false); const s = new TextDecoder().decode(data.subarray(0, r.nread)); - assertEqual(s, "hello"); + assertEquals(s, "hello"); r = await p.stderr.read(data); - assertEqual(r.nread, 0); - assertEqual(r.eof, true); + assertEquals(r.nread, 0); + assertEquals(r.eof, true); p.stderr.close(); const status = await p.status(); - assertEqual(status.success, true); - assertEqual(status.code, 0); - assertEqual(status.signal, undefined); + assertEquals(status.success, true); + assertEquals(status.code, 0); + assertEquals(status.signal, undefined); p.close(); }); @@ -183,7 +183,7 @@ testPerm({ run: true }, async function runOutput() { }); const output = await p.output(); const s = new TextDecoder().decode(output); - assertEqual(s, "hello"); + assertEquals(s, "hello"); p.close(); }); @@ -202,6 +202,6 @@ testPerm({ run: true }, async function runEnv() { }); const output = await p.output(); const s = new TextDecoder().decode(output); - assertEqual(s, "01234567"); + assertEquals(s, "01234567"); p.close(); }); diff --git a/js/read_dir_test.ts b/js/read_dir_test.ts index 54cc468b7e..914c2b2a85 100644 --- a/js/read_dir_test.ts +++ b/js/read_dir_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assert, assertEqual } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; type FileInfo = Deno.FileInfo; @@ -13,13 +13,13 @@ function assertSameContent(files: FileInfo[]) { } if (file.name === "002_hello.ts") { - assertEqual(file.path, `tests/${file.name}`); - assertEqual(file.mode!, Deno.statSync(`tests/${file.name}`).mode!); + assertEquals(file.path, `tests/${file.name}`); + assertEquals(file.mode!, Deno.statSync(`tests/${file.name}`).mode!); counter++; } } - assertEqual(counter, 2); + assertEquals(counter, 2); } testPerm({ read: true }, function readDirSyncSuccess() { @@ -33,8 +33,8 @@ testPerm({ read: false }, function readDirSyncPerm() { const files = Deno.readDirSync("tests/"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -47,10 +47,10 @@ testPerm({ read: true }, function readDirSyncNotDir() { src = Deno.readDirSync("package.json"); } catch (err) { caughtError = true; - assertEqual(err.kind, Deno.ErrorKind.Other); + assertEquals(err.kind, Deno.ErrorKind.Other); } assert(caughtError); - assertEqual(src, undefined); + assertEquals(src, undefined); }); testPerm({ read: true }, function readDirSyncNotFound() { @@ -61,10 +61,10 @@ testPerm({ read: true }, function readDirSyncNotFound() { src = Deno.readDirSync("bad_dir_name"); } catch (err) { caughtError = true; - assertEqual(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.kind, Deno.ErrorKind.NotFound); } assert(caughtError); - assertEqual(src, undefined); + assertEquals(src, undefined); }); testPerm({ read: true }, async function readDirSuccess() { @@ -78,8 +78,8 @@ testPerm({ read: false }, async function readDirPerm() { const files = await Deno.readDir("tests/"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); diff --git a/js/read_file_test.ts b/js/read_file_test.ts index aff28e64c3..4724158e95 100644 --- a/js/read_file_test.ts +++ b/js/read_file_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assert, assertEqual } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ read: true }, function readFileSyncSuccess() { const data = Deno.readFileSync("package.json"); @@ -7,7 +7,7 @@ testPerm({ read: true }, function readFileSyncSuccess() { const decoder = new TextDecoder("utf-8"); const json = decoder.decode(data); const pkg = JSON.parse(json); - assertEqual(pkg.name, "deno"); + assertEquals(pkg.name, "deno"); }); testPerm({ read: false }, function readFileSyncPerm() { @@ -16,8 +16,8 @@ testPerm({ read: false }, function readFileSyncPerm() { const data = Deno.readFileSync("package.json"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -29,7 +29,7 @@ testPerm({ read: true }, function readFileSyncNotFound() { data = Deno.readFileSync("bad_filename"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.NotFound); + assertEquals(e.kind, Deno.ErrorKind.NotFound); } assert(caughtError); assert(data === undefined); @@ -41,7 +41,7 @@ testPerm({ read: true }, async function readFileSuccess() { const decoder = new TextDecoder("utf-8"); const json = decoder.decode(data); const pkg = JSON.parse(json); - assertEqual(pkg.name, "deno"); + assertEquals(pkg.name, "deno"); }); testPerm({ read: false }, async function readFilePerm() { @@ -50,8 +50,8 @@ testPerm({ read: false }, async function readFilePerm() { await Deno.readFile("package.json"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); diff --git a/js/read_link_test.ts b/js/read_link_test.ts index cbef6334e9..270ae54fa3 100644 --- a/js/read_link_test.ts +++ b/js/read_link_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assert, assertEqual } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ write: true, read: true }, function readlinkSyncSuccess() { const testDir = Deno.makeTempDirSync(); @@ -11,7 +11,7 @@ testPerm({ write: true, read: true }, function readlinkSyncSuccess() { if (Deno.build.os !== "win") { Deno.symlinkSync(target, symlink); const targetPath = Deno.readlinkSync(symlink); - assertEqual(targetPath, target); + assertEquals(targetPath, target); } }); @@ -21,8 +21,8 @@ testPerm({ read: false }, async function readlinkSyncPerm() { Deno.readlinkSync("/symlink"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -34,10 +34,10 @@ testPerm({ read: true }, function readlinkSyncNotFound() { data = Deno.readlinkSync("bad_filename"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.NotFound); + assertEquals(e.kind, Deno.ErrorKind.NotFound); } assert(caughtError); - assertEqual(data, undefined); + assertEquals(data, undefined); }); testPerm({ write: true, read: true }, async function readlinkSuccess() { @@ -50,7 +50,7 @@ testPerm({ write: true, read: true }, async function readlinkSuccess() { if (Deno.build.os !== "win") { Deno.symlinkSync(target, symlink); const targetPath = await Deno.readlink(symlink); - assertEqual(targetPath, target); + assertEquals(targetPath, target); } }); @@ -60,8 +60,8 @@ testPerm({ read: false }, async function readlinkPerm() { await Deno.readlink("/symlink"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); diff --git a/js/remove_test.ts b/js/remove_test.ts index e4fe24c6bb..e48b9a068a 100644 --- a/js/remove_test.ts +++ b/js/remove_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assert, assertEqual } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; // SYNC @@ -18,8 +18,8 @@ testPerm({ write: true }, function removeSyncDirSuccess() { err = e; } // Directory is gone - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: true }, function removeSyncFileSuccess() { @@ -39,8 +39,8 @@ testPerm({ write: true }, function removeSyncFileSuccess() { err = e; } // File is gone - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: true }, function removeSyncFail() { @@ -61,8 +61,8 @@ testPerm({ write: true }, function removeSyncFail() { err = e; } // TODO(ry) Is Other really the error we should get here? What would Go do? - assertEqual(err.kind, Deno.ErrorKind.Other); - assertEqual(err.name, "Other"); + assertEquals(err.kind, Deno.ErrorKind.Other); + assertEquals(err.name, "Other"); // NON-EXISTENT DIRECTORY/FILE try { // Non-existent @@ -70,8 +70,8 @@ testPerm({ write: true }, function removeSyncFail() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: false }, function removeSyncPerm() { @@ -81,8 +81,8 @@ testPerm({ write: false }, function removeSyncPerm() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); testPerm({ write: true }, function removeAllSyncDirSuccess() { @@ -100,8 +100,8 @@ testPerm({ write: true }, function removeAllSyncDirSuccess() { err = e; } // Directory is gone - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); // REMOVE NON-EMPTY DIRECTORY path = Deno.makeTempDirSync() + "/dir/subdir"; const subPath = path + "/subsubdir"; @@ -119,8 +119,8 @@ testPerm({ write: true }, function removeAllSyncDirSuccess() { err = e; } // Directory is gone - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: true }, function removeAllSyncFileSuccess() { @@ -140,8 +140,8 @@ testPerm({ write: true }, function removeAllSyncFileSuccess() { err = e; } // File is gone - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: true }, function removeAllSyncFail() { @@ -153,8 +153,8 @@ testPerm({ write: true }, function removeAllSyncFail() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: false }, function removeAllSyncPerm() { @@ -164,8 +164,8 @@ testPerm({ write: false }, function removeAllSyncPerm() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); // ASYNC @@ -185,8 +185,8 @@ testPerm({ write: true }, async function removeDirSuccess() { err = e; } // Directory is gone - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: true }, async function removeFileSuccess() { @@ -206,8 +206,8 @@ testPerm({ write: true }, async function removeFileSuccess() { err = e; } // File is gone - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: true }, async function removeFail() { @@ -227,8 +227,8 @@ testPerm({ write: true }, async function removeFail() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.Other); - assertEqual(err.name, "Other"); + assertEquals(err.kind, Deno.ErrorKind.Other); + assertEquals(err.name, "Other"); // NON-EXISTENT DIRECTORY/FILE try { // Non-existent @@ -236,8 +236,8 @@ testPerm({ write: true }, async function removeFail() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: false }, async function removePerm() { @@ -247,8 +247,8 @@ testPerm({ write: false }, async function removePerm() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); testPerm({ write: true }, async function removeAllDirSuccess() { @@ -266,8 +266,8 @@ testPerm({ write: true }, async function removeAllDirSuccess() { err = e; } // Directory is gone - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); // REMOVE NON-EMPTY DIRECTORY path = Deno.makeTempDirSync() + "/dir/subdir"; const subPath = path + "/subsubdir"; @@ -285,8 +285,8 @@ testPerm({ write: true }, async function removeAllDirSuccess() { err = e; } // Directory is gone - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: true }, async function removeAllFileSuccess() { @@ -306,8 +306,8 @@ testPerm({ write: true }, async function removeAllFileSuccess() { err = e; } // File is gone - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: true }, async function removeAllFail() { @@ -319,8 +319,8 @@ testPerm({ write: true }, async function removeAllFail() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); }); testPerm({ write: false }, async function removeAllPerm() { @@ -330,6 +330,6 @@ testPerm({ write: false }, async function removeAllPerm() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); diff --git a/js/rename_test.ts b/js/rename_test.ts index 0d48169d0f..689787115c 100644 --- a/js/rename_test.ts +++ b/js/rename_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assert, assertEqual } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ read: true, write: true }, function renameSyncSuccess() { const testDir = Deno.makeTempDirSync(); @@ -17,10 +17,10 @@ testPerm({ read: true, write: true }, function renameSyncSuccess() { oldPathInfo = Deno.statSync(oldpath); } catch (e) { caughtErr = true; - assertEqual(e.kind, Deno.ErrorKind.NotFound); + assertEquals(e.kind, Deno.ErrorKind.NotFound); } assert(caughtErr); - assertEqual(oldPathInfo, undefined); + assertEquals(oldPathInfo, undefined); }); testPerm({ read: true, write: false }, function renameSyncPerm() { @@ -32,8 +32,8 @@ testPerm({ read: true, write: false }, function renameSyncPerm() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); testPerm({ read: true, write: true }, async function renameSuccess() { @@ -52,8 +52,8 @@ testPerm({ read: true, write: true }, async function renameSuccess() { oldPathInfo = Deno.statSync(oldpath); } catch (e) { caughtErr = true; - assertEqual(e.kind, Deno.ErrorKind.NotFound); + assertEquals(e.kind, Deno.ErrorKind.NotFound); } assert(caughtErr); - assertEqual(oldPathInfo, undefined); + assertEquals(oldPathInfo, undefined); }); diff --git a/js/resources_test.ts b/js/resources_test.ts index 65002e164f..eeb3b34499 100644 --- a/js/resources_test.ts +++ b/js/resources_test.ts @@ -1,12 +1,12 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, testPerm, assertEqual } from "./test_util.ts"; +import { test, testPerm, assertEquals } from "./test_util.ts"; test(function resourcesStdio() { const res = Deno.resources(); - assertEqual(res[0], "stdin"); - assertEqual(res[1], "stdout"); - assertEqual(res[2], "stderr"); + assertEquals(res[0], "stdin"); + assertEquals(res[1], "stdout"); + assertEquals(res[2], "stderr"); }); testPerm({ net: true }, async function resourcesNet() { @@ -17,8 +17,8 @@ testPerm({ net: true }, async function resourcesNet() { const listenerConn = await listener.accept(); const res = Deno.resources(); - assertEqual(Object.values(res).filter(r => r === "tcpListener").length, 1); - assertEqual(Object.values(res).filter(r => r === "tcpStream").length, 2); + assertEquals(Object.values(res).filter(r => r === "tcpListener").length, 1); + assertEquals(Object.values(res).filter(r => r === "tcpStream").length, 2); listenerConn.close(); dialerConn.close(); @@ -31,12 +31,12 @@ testPerm({ read: true }, async function resourcesFile() { const resourcesAfter = Deno.resources(); // check that exactly one new resource (file) was added - assertEqual( + assertEquals( Object.keys(resourcesAfter).length, Object.keys(resourcesBefore).length + 1 ); const newRid = Object.keys(resourcesAfter).find(rid => { return !resourcesBefore.hasOwnProperty(rid); }); - assertEqual(resourcesAfter[newRid], "fsFile"); + assertEquals(resourcesAfter[newRid], "fsFile"); }); diff --git a/js/stat_test.ts b/js/stat_test.ts index bf8f6b9aa9..3a109c0b5e 100644 --- a/js/stat_test.ts +++ b/js/stat_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assert, assertEqual } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; // TODO Add tests for modified, accessed, and created fields once there is a way // to create temp files. @@ -23,8 +23,8 @@ testPerm({ read: false }, async function statSyncPerm() { Deno.statSync("package.json"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -37,12 +37,12 @@ testPerm({ read: true }, async function statSyncNotFound() { badInfo = Deno.statSync("bad_file_name"); } catch (err) { caughtError = true; - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); } assert(caughtError); - assertEqual(badInfo, undefined); + assertEquals(badInfo, undefined); }); testPerm({ read: true }, async function lstatSyncSuccess() { @@ -65,8 +65,8 @@ testPerm({ read: false }, async function lstatSyncPerm() { Deno.lstatSync("package.json"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -79,12 +79,12 @@ testPerm({ read: true }, async function lstatSyncNotFound() { badInfo = Deno.lstatSync("bad_file_name"); } catch (err) { caughtError = true; - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); } assert(caughtError); - assertEqual(badInfo, undefined); + assertEquals(badInfo, undefined); }); testPerm({ read: true }, async function statSuccess() { @@ -107,8 +107,8 @@ testPerm({ read: false }, async function statPerm() { await Deno.stat("package.json"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -121,12 +121,12 @@ testPerm({ read: true }, async function statNotFound() { badInfo = await Deno.stat("bad_file_name"); } catch (err) { caughtError = true; - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); } assert(caughtError); - assertEqual(badInfo, undefined); + assertEquals(badInfo, undefined); }); testPerm({ read: true }, async function lstatSuccess() { @@ -149,8 +149,8 @@ testPerm({ read: false }, async function lstatPerm() { await Deno.lstat("package.json"); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -163,10 +163,10 @@ testPerm({ read: true }, async function lstatNotFound() { badInfo = await Deno.lstat("bad_file_name"); } catch (err) { caughtError = true; - assertEqual(err.kind, Deno.ErrorKind.NotFound); - assertEqual(err.name, "NotFound"); + assertEquals(err.kind, Deno.ErrorKind.NotFound); + assertEquals(err.name, "NotFound"); } assert(caughtError); - assertEqual(badInfo, undefined); + assertEquals(badInfo, undefined); }); diff --git a/js/symlink_test.ts b/js/symlink_test.ts index 6fa78ac3f4..37b157294c 100644 --- a/js/symlink_test.ts +++ b/js/symlink_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, testPerm, assert, assertEqual } from "./test_util.ts"; +import { test, testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ read: true, write: true }, function symlinkSyncSuccess() { const testDir = Deno.makeTempDirSync(); @@ -14,8 +14,8 @@ testPerm({ read: true, write: true }, function symlinkSyncSuccess() { errOnWindows = e; } if (errOnWindows) { - assertEqual(errOnWindows.kind, Deno.ErrorKind.Other); - assertEqual(errOnWindows.message, "Not implemented"); + assertEquals(errOnWindows.kind, Deno.ErrorKind.Other); + assertEquals(errOnWindows.message, "Not implemented"); } else { const newNameInfoLStat = Deno.lstatSync(newname); const newNameInfoStat = Deno.statSync(newname); @@ -31,8 +31,8 @@ test(function symlinkSyncPerm() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); // Just for now, until we implement symlink for Windows. @@ -43,7 +43,7 @@ testPerm({ write: true }, function symlinkSyncNotImplemented() { } catch (e) { err = e; } - assertEqual(err.message, "Not implemented"); + assertEquals(err.message, "Not implemented"); }); testPerm({ read: true, write: true }, async function symlinkSuccess() { @@ -59,8 +59,8 @@ testPerm({ read: true, write: true }, async function symlinkSuccess() { errOnWindows = e; } if (errOnWindows) { - assertEqual(errOnWindows.kind, Deno.ErrorKind.Other); - assertEqual(errOnWindows.message, "Not implemented"); + assertEquals(errOnWindows.kind, Deno.ErrorKind.Other); + assertEquals(errOnWindows.message, "Not implemented"); } else { const newNameInfoLStat = Deno.lstatSync(newname); const newNameInfoStat = Deno.statSync(newname); diff --git a/js/test_util.ts b/js/test_util.ts index c852840194..7cc80e5816 100644 --- a/js/test_util.ts +++ b/js/test_util.ts @@ -8,7 +8,14 @@ // See tools/unit_tests.py for more details. import * as testing from "./deps/https/deno.land/std/testing/mod.ts"; -export { assert, assertEqual } from "./deps/https/deno.land/std/testing/mod.ts"; +import { + assert, + assertEquals +} from "./deps/https/deno.land/std/testing/asserts.ts"; +export { + assert, + assertEquals +} from "./deps/https/deno.land/std/testing/asserts.ts"; // testing.setFilter must be run before any tests are defined. testing.setFilter(Deno.args[1]); @@ -64,7 +71,7 @@ test(function permSerialization() { for (const run of [true, false]) { for (const read of [true, false]) { const perms: DenoPermissions = { write, net, env, run, read }; - testing.assertEqual(perms, permFromString(permToString(perms))); + assertEquals(perms, permFromString(permToString(perms))); } } } @@ -81,5 +88,5 @@ test(function permFromStringThrows() { } catch (e) { threw = true; } - testing.assert(threw); + assert(threw); }); diff --git a/js/text_encoding_test.ts b/js/text_encoding_test.ts index 41df882e31..f7939499a7 100644 --- a/js/text_encoding_test.ts +++ b/js/text_encoding_test.ts @@ -1,16 +1,16 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assert, assertEqual } from "./test_util.ts"; +import { test, assert, assertEquals } from "./test_util.ts"; test(function atobSuccess() { const text = "hello world"; const encoded = btoa(text); - assertEqual(encoded, "aGVsbG8gd29ybGQ="); + assertEquals(encoded, "aGVsbG8gd29ybGQ="); }); test(function btoaSuccess() { const encoded = "aGVsbG8gd29ybGQ="; const decoded = atob(encoded); - assertEqual(decoded, "hello world"); + assertEquals(decoded, "hello world"); }); test(function btoaFailed() { @@ -22,7 +22,7 @@ test(function btoaFailed() { err = e; } assert(!!err); - assertEqual(err.name, "InvalidInput"); + assertEquals(err.name, "InvalidInput"); }); test(function textDecoder2() { @@ -34,13 +34,13 @@ test(function textDecoder2() { 0xf0, 0x9d, 0x93, 0xbd ]); const decoder = new TextDecoder(); - assertEqual(decoder.decode(fixture), "𝓽𝓮𝔁𝓽"); + assertEquals(decoder.decode(fixture), "𝓽𝓮𝔁𝓽"); }); test(function textDecoderASCII() { const fixture = new Uint8Array([0x89, 0x95, 0x9f, 0xbf]); const decoder = new TextDecoder("ascii"); - assertEqual(decoder.decode(fixture), "‰•Ÿ¿"); + assertEquals(decoder.decode(fixture), "‰•Ÿ¿"); }); test(function textDecoderErrorEncoding() { @@ -49,7 +49,7 @@ test(function textDecoderErrorEncoding() { const decoder = new TextDecoder("foo"); } catch (e) { didThrow = true; - assertEqual(e.message, "The encoding label provided ('foo') is invalid."); + assertEquals(e.message, "The encoding label provided ('foo') is invalid."); } assert(didThrow); }); @@ -58,7 +58,7 @@ test(function textEncoder2() { const fixture = "𝓽𝓮𝔁𝓽"; const encoder = new TextEncoder(); // prettier-ignore - assertEqual(Array.from(encoder.encode(fixture)), [ + assertEquals(Array.from(encoder.encode(fixture)), [ 0xf0, 0x9d, 0x93, 0xbd, 0xf0, 0x9d, 0x93, 0xae, 0xf0, 0x9d, 0x94, 0x81, diff --git a/js/timers_test.ts b/js/timers_test.ts index fe2ff64df6..d40c01376e 100644 --- a/js/timers_test.ts +++ b/js/timers_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assertEqual } from "./test_util.ts"; +import { test, assertEquals } from "./test_util.ts"; function deferred() { let resolve; @@ -28,7 +28,7 @@ test(async function timeoutSuccess() { }, 500); await promise; // count should increment - assertEqual(count, 1); + assertEquals(count, 1); }); test(async function timeoutArgs() { @@ -36,9 +36,9 @@ test(async function timeoutArgs() { const arg = 1; setTimeout( (a, b, c) => { - assertEqual(a, arg); - assertEqual(b, arg.toString()); - assertEqual(c, [arg]); + assertEquals(a, arg); + assertEquals(b, arg.toString()); + assertEquals(c, [arg]); resolve(); }, 10, @@ -58,7 +58,7 @@ test(async function timeoutCancelSuccess() { clearTimeout(id); // Wait a bit longer than 500ms await waitForMs(600); - assertEqual(count, 0); + assertEquals(count, 0); }); test(async function timeoutCancelMultiple() { @@ -97,7 +97,7 @@ test(async function timeoutCancelInvalidSilentFail() { resolve(); }, 500); await promise; - assertEqual(count, 1); + assertEquals(count, 1); // Should silently fail (no panic) clearTimeout(2147483647); @@ -120,7 +120,7 @@ test(async function intervalSuccess() { // Clear interval clearInterval(id); // count should increment twice - assertEqual(count, 2); + assertEquals(count, 2); }); test(async function intervalCancelSuccess() { @@ -132,7 +132,7 @@ test(async function intervalCancelSuccess() { clearInterval(id); // Wait a bit longer than 500ms await waitForMs(600); - assertEqual(count, 0); + assertEquals(count, 0); }); test(async function intervalOrdering() { @@ -148,7 +148,7 @@ test(async function intervalOrdering() { } } await waitForMs(100); - assertEqual(timeouts, 1); + assertEquals(timeouts, 1); }); test(async function intervalCancelInvalidSilentFail() { @@ -162,5 +162,5 @@ test(async function fireCallbackImmediatelyWhenDelayOverMaxValue() { count++; }, 2 ** 31); await waitForMs(1); - assertEqual(count, 1); + assertEquals(count, 1); }); diff --git a/js/truncate_test.ts b/js/truncate_test.ts index 2bca68a38d..09830c073b 100644 --- a/js/truncate_test.ts +++ b/js/truncate_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assertEqual } from "./test_util.ts"; +import { testPerm, assertEquals } from "./test_util.ts"; function readDataSync(name: string): string { const data = Deno.readFileSync(name); @@ -22,13 +22,13 @@ testPerm({ read: true, write: true }, function truncateSyncSuccess() { Deno.writeFileSync(filename, d); Deno.truncateSync(filename, 20); let data = readDataSync(filename); - assertEqual(data.length, 20); + assertEquals(data.length, 20); Deno.truncateSync(filename, 5); data = readDataSync(filename); - assertEqual(data.length, 5); + assertEquals(data.length, 5); Deno.truncateSync(filename, -5); data = readDataSync(filename); - assertEqual(data.length, 0); + assertEquals(data.length, 0); Deno.removeSync(filename); }); @@ -39,13 +39,13 @@ testPerm({ read: true, write: true }, async function truncateSuccess() { await Deno.writeFile(filename, d); await Deno.truncate(filename, 20); let data = await readData(filename); - assertEqual(data.length, 20); + assertEquals(data.length, 20); await Deno.truncate(filename, 5); data = await readData(filename); - assertEqual(data.length, 5); + assertEquals(data.length, 5); await Deno.truncate(filename, -5); data = await readData(filename); - assertEqual(data.length, 0); + assertEquals(data.length, 0); await Deno.remove(filename); }); @@ -56,8 +56,8 @@ testPerm({ write: false }, function truncateSyncPerm() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); testPerm({ write: false }, async function truncatePerm() { @@ -67,6 +67,6 @@ testPerm({ write: false }, async function truncatePerm() { } catch (e) { err = e; } - assertEqual(err.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(err.name, "PermissionDenied"); + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); }); diff --git a/js/url_search_params_test.ts b/js/url_search_params_test.ts index 7f31c71119..b93e4f4b0f 100644 --- a/js/url_search_params_test.ts +++ b/js/url_search_params_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assert, assertEqual } from "./test_util.ts"; +import { test, assert, assertEquals } from "./test_util.ts"; test(function urlSearchParamsInitString() { const init = "c=4&a=2&b=3&%C3%A1=1"; @@ -13,42 +13,42 @@ test(function urlSearchParamsInitString() { test(function urlSearchParamsInitIterable() { const init = [["a", "54"], ["b", "true"]]; const searchParams = new URLSearchParams(init); - assertEqual(searchParams.toString(), "a=54&b=true"); + assertEquals(searchParams.toString(), "a=54&b=true"); }); test(function urlSearchParamsInitRecord() { const init = { a: "54", b: "true" }; const searchParams = new URLSearchParams(init); - assertEqual(searchParams.toString(), "a=54&b=true"); + assertEquals(searchParams.toString(), "a=54&b=true"); }); test(function urlSearchParamsAppendSuccess() { const searchParams = new URLSearchParams(); searchParams.append("a", "true"); - assertEqual(searchParams.toString(), "a=true"); + assertEquals(searchParams.toString(), "a=true"); }); test(function urlSearchParamsDeleteSuccess() { const init = "a=54&b=true"; const searchParams = new URLSearchParams(init); searchParams.delete("b"); - assertEqual(searchParams.toString(), "a=54"); + assertEquals(searchParams.toString(), "a=54"); }); test(function urlSearchParamsGetAllSuccess() { const init = "a=54&b=true&a=true"; const searchParams = new URLSearchParams(init); - assertEqual(searchParams.getAll("a"), ["54", "true"]); - assertEqual(searchParams.getAll("b"), ["true"]); - assertEqual(searchParams.getAll("c"), []); + assertEquals(searchParams.getAll("a"), ["54", "true"]); + assertEquals(searchParams.getAll("b"), ["true"]); + assertEquals(searchParams.getAll("c"), []); }); test(function urlSearchParamsGetSuccess() { const init = "a=54&b=true&a=true"; const searchParams = new URLSearchParams(init); - assertEqual(searchParams.get("a"), "54"); - assertEqual(searchParams.get("b"), "true"); - assertEqual(searchParams.get("c"), null); + assertEquals(searchParams.get("a"), "54"); + assertEquals(searchParams.get("b"), "true"); + assertEquals(searchParams.get("c"), null); }); test(function urlSearchParamsHasSuccess() { @@ -63,21 +63,21 @@ test(function urlSearchParamsSetReplaceFirstAndRemoveOthers() { const init = "a=54&b=true&a=true"; const searchParams = new URLSearchParams(init); searchParams.set("a", "false"); - assertEqual(searchParams.toString(), "a=false&b=true"); + assertEquals(searchParams.toString(), "a=false&b=true"); }); test(function urlSearchParamsSetAppendNew() { const init = "a=54&b=true&a=true"; const searchParams = new URLSearchParams(init); searchParams.set("c", "foo"); - assertEqual(searchParams.toString(), "a=54&b=true&a=true&c=foo"); + assertEquals(searchParams.toString(), "a=54&b=true&a=true&c=foo"); }); test(function urlSearchParamsSortSuccess() { const init = "c=4&a=2&b=3&a=1"; const searchParams = new URLSearchParams(init); searchParams.sort(); - assertEqual(searchParams.toString(), "a=2&a=1&b=3&c=4"); + assertEquals(searchParams.toString(), "a=2&a=1&b=3&c=4"); }); test(function urlSearchParamsForEachSuccess() { @@ -85,39 +85,39 @@ test(function urlSearchParamsForEachSuccess() { const searchParams = new URLSearchParams(init); let callNum = 0; searchParams.forEach((value, key, parent) => { - assertEqual(searchParams, parent); - assertEqual(value, init[callNum][1]); - assertEqual(key, init[callNum][0]); + assertEquals(searchParams, parent); + assertEquals(value, init[callNum][1]); + assertEquals(key, init[callNum][0]); callNum++; }); - assertEqual(callNum, init.length); + assertEquals(callNum, init.length); }); test(function urlSearchParamsMissingName() { const init = "=4"; const searchParams = new URLSearchParams(init); - assertEqual(searchParams.get(""), "4"); - assertEqual(searchParams.toString(), "=4"); + assertEquals(searchParams.get(""), "4"); + assertEquals(searchParams.toString(), "=4"); }); test(function urlSearchParamsMissingValue() { const init = "4="; const searchParams = new URLSearchParams(init); - assertEqual(searchParams.get("4"), ""); - assertEqual(searchParams.toString(), "4="); + assertEquals(searchParams.get("4"), ""); + assertEquals(searchParams.toString(), "4="); }); test(function urlSearchParamsMissingEqualSign() { const init = "4"; const searchParams = new URLSearchParams(init); - assertEqual(searchParams.get("4"), ""); - assertEqual(searchParams.toString(), "4="); + assertEquals(searchParams.get("4"), ""); + assertEquals(searchParams.toString(), "4="); }); test(function urlSearchParamsMissingPair() { const init = "c=4&&a=54&"; const searchParams = new URLSearchParams(init); - assertEqual(searchParams.toString(), "c=4&a=54"); + assertEquals(searchParams.toString(), "c=4&a=54"); }); // If pair does not contain exactly two items, then throw a TypeError. @@ -136,7 +136,7 @@ test(function urlSearchParamsShouldThrowTypeError() { } } - assertEqual(hasThrown, 2); + assertEquals(hasThrown, 2); }); test(function urlSearchParamsAppendArgumentsCheck() { @@ -157,7 +157,7 @@ test(function urlSearchParamsAppendArgumentsCheck() { hasThrown = 3; } } - assertEqual(hasThrown, 2); + assertEquals(hasThrown, 2); }); methodRequireTwoParams.forEach(method => { @@ -173,6 +173,6 @@ test(function urlSearchParamsAppendArgumentsCheck() { hasThrown = 3; } } - assertEqual(hasThrown, 2); + assertEquals(hasThrown, 2); }); }); diff --git a/js/url_test.ts b/js/url_test.ts index d001b83064..643490e450 100644 --- a/js/url_test.ts +++ b/js/url_test.ts @@ -1,31 +1,31 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assert, assertEqual } from "./test_util.ts"; +import { test, assert, assertEquals } from "./test_util.ts"; test(function urlParsing() { const url = new URL( "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" ); - assertEqual(url.hash, "#qat"); - assertEqual(url.host, "baz.qat:8000"); - assertEqual(url.hostname, "baz.qat"); - assertEqual( + assertEquals(url.hash, "#qat"); + assertEquals(url.host, "baz.qat:8000"); + assertEquals(url.hostname, "baz.qat"); + assertEquals( url.href, "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" ); - assertEqual(url.origin, "https://baz.qat:8000"); - assertEqual(url.password, "bar"); - assertEqual(url.pathname, "/qux/quux"); - assertEqual(url.port, "8000"); - assertEqual(url.protocol, "https:"); - assertEqual(url.search, "?foo=bar&baz=12"); - assertEqual(url.searchParams.getAll("foo"), ["bar"]); - assertEqual(url.searchParams.getAll("baz"), ["12"]); - assertEqual(url.username, "foo"); - assertEqual( + assertEquals(url.origin, "https://baz.qat:8000"); + assertEquals(url.password, "bar"); + assertEquals(url.pathname, "/qux/quux"); + assertEquals(url.port, "8000"); + assertEquals(url.protocol, "https:"); + assertEquals(url.search, "?foo=bar&baz=12"); + assertEquals(url.searchParams.getAll("foo"), ["bar"]); + assertEquals(url.searchParams.getAll("baz"), ["12"]); + assertEquals(url.username, "foo"); + assertEquals( String(url), "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" ); - assertEqual( + assertEquals( JSON.stringify({ key: url }), `{"key":"https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat"}` ); @@ -36,39 +36,51 @@ test(function urlModifications() { "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" ); url.hash = ""; - assertEqual(url.href, "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12"); + assertEquals( + url.href, + "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12" + ); url.host = "qat.baz:8080"; - assertEqual(url.href, "https://foo:bar@qat.baz:8080/qux/quux?foo=bar&baz=12"); + assertEquals( + url.href, + "https://foo:bar@qat.baz:8080/qux/quux?foo=bar&baz=12" + ); url.hostname = "foo.bar"; - assertEqual(url.href, "https://foo:bar@foo.bar:8080/qux/quux?foo=bar&baz=12"); + assertEquals( + url.href, + "https://foo:bar@foo.bar:8080/qux/quux?foo=bar&baz=12" + ); url.password = "qux"; - assertEqual(url.href, "https://foo:qux@foo.bar:8080/qux/quux?foo=bar&baz=12"); + assertEquals( + url.href, + "https://foo:qux@foo.bar:8080/qux/quux?foo=bar&baz=12" + ); url.pathname = "/foo/bar%qat"; - assertEqual( + assertEquals( url.href, "https://foo:qux@foo.bar:8080/foo/bar%qat?foo=bar&baz=12" ); url.port = ""; - assertEqual(url.href, "https://foo:qux@foo.bar/foo/bar%qat?foo=bar&baz=12"); + assertEquals(url.href, "https://foo:qux@foo.bar/foo/bar%qat?foo=bar&baz=12"); url.protocol = "http:"; - assertEqual(url.href, "http://foo:qux@foo.bar/foo/bar%qat?foo=bar&baz=12"); + assertEquals(url.href, "http://foo:qux@foo.bar/foo/bar%qat?foo=bar&baz=12"); url.search = "?foo=bar&foo=baz"; - assertEqual(url.href, "http://foo:qux@foo.bar/foo/bar%qat?foo=bar&foo=baz"); - assertEqual(url.searchParams.getAll("foo"), ["bar", "baz"]); + assertEquals(url.href, "http://foo:qux@foo.bar/foo/bar%qat?foo=bar&foo=baz"); + assertEquals(url.searchParams.getAll("foo"), ["bar", "baz"]); url.username = "foo@bar"; - assertEqual( + assertEquals( url.href, "http://foo%40bar:qux@foo.bar/foo/bar%qat?foo=bar&foo=baz" ); url.searchParams.set("bar", "qat"); - assertEqual( + assertEquals( url.href, "http://foo%40bar:qux@foo.bar/foo/bar%qat?foo=bar&foo=baz&bar=qat" ); url.searchParams.delete("foo"); - assertEqual(url.href, "http://foo%40bar:qux@foo.bar/foo/bar%qat?bar=qat"); + assertEquals(url.href, "http://foo%40bar:qux@foo.bar/foo/bar%qat?bar=qat"); url.searchParams.append("foo", "bar"); - assertEqual( + assertEquals( url.href, "http://foo%40bar:qux@foo.bar/foo/bar%qat?bar=qat&foo=bar" ); @@ -77,32 +89,32 @@ test(function urlModifications() { test(function urlModifyHref() { const url = new URL("http://example.com/"); url.href = "https://foo:bar@example.com:8080/baz/qat#qux"; - assertEqual(url.protocol, "https:"); - assertEqual(url.username, "foo"); - assertEqual(url.password, "bar"); - assertEqual(url.host, "example.com:8080"); - assertEqual(url.hostname, "example.com"); - assertEqual(url.pathname, "/baz/qat"); - assertEqual(url.hash, "#qux"); + assertEquals(url.protocol, "https:"); + assertEquals(url.username, "foo"); + assertEquals(url.password, "bar"); + assertEquals(url.host, "example.com:8080"); + assertEquals(url.hostname, "example.com"); + assertEquals(url.pathname, "/baz/qat"); + assertEquals(url.hash, "#qux"); }); test(function urlModifyPathname() { const url = new URL("http://foo.bar/baz%qat/qux%quux"); - assertEqual(url.pathname, "/baz%qat/qux%quux"); + assertEquals(url.pathname, "/baz%qat/qux%quux"); url.pathname = url.pathname; - assertEqual(url.pathname, "/baz%qat/qux%quux"); + assertEquals(url.pathname, "/baz%qat/qux%quux"); url.pathname = "baz#qat qux"; - assertEqual(url.pathname, "/baz%23qat%20qux"); + assertEquals(url.pathname, "/baz%23qat%20qux"); url.pathname = url.pathname; - assertEqual(url.pathname, "/baz%23qat%20qux"); + assertEquals(url.pathname, "/baz%23qat%20qux"); }); test(function urlModifyHash() { const url = new URL("http://foo.bar"); url.hash = "%foo bar/qat%qux#bar"; - assertEqual(url.hash, "#%foo%20bar/qat%qux#bar"); + assertEquals(url.hash, "#%foo%20bar/qat%qux#bar"); url.hash = url.hash; - assertEqual(url.hash, "#%foo%20bar/qat%qux#bar"); + assertEquals(url.hash, "#%foo%20bar/qat%qux#bar"); }); test(function urlSearchParamsReuse() { @@ -119,7 +131,7 @@ test(function urlBaseURL() { "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" ); const url = new URL("/foo/bar?baz=foo#qux", base); - assertEqual(url.href, "https://foo:bar@baz.qat:8000/foo/bar?baz=foo#qux"); + assertEquals(url.href, "https://foo:bar@baz.qat:8000/foo/bar?baz=foo#qux"); }); test(function urlBaseString() { @@ -127,5 +139,5 @@ test(function urlBaseString() { "/foo/bar?baz=foo#qux", "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" ); - assertEqual(url.href, "https://foo:bar@baz.qat:8000/foo/bar?baz=foo#qux"); + assertEquals(url.href, "https://foo:bar@baz.qat:8000/foo/bar?baz=foo#qux"); }); diff --git a/js/write_file_test.ts b/js/write_file_test.ts index 67419a7f60..07f8dca7aa 100644 --- a/js/write_file_test.ts +++ b/js/write_file_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { testPerm, assert, assertEqual } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ read: true, write: true }, function writeFileSyncSuccess() { const enc = new TextEncoder(); @@ -9,7 +9,7 @@ testPerm({ read: true, write: true }, function writeFileSyncSuccess() { const dataRead = Deno.readFileSync(filename); const dec = new TextDecoder("utf-8"); const actual = dec.decode(dataRead); - assertEqual("Hello", actual); + assertEquals("Hello", actual); }); testPerm({ write: true }, function writeFileSyncFail() { @@ -22,8 +22,8 @@ testPerm({ write: true }, function writeFileSyncFail() { Deno.writeFileSync(filename, data); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.NotFound); - assertEqual(e.name, "NotFound"); + assertEquals(e.kind, Deno.ErrorKind.NotFound); + assertEquals(e.name, "NotFound"); } assert(caughtError); }); @@ -38,8 +38,8 @@ testPerm({ write: false }, function writeFileSyncPerm() { Deno.writeFileSync(filename, data); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -50,9 +50,9 @@ testPerm({ read: true, write: true }, function writeFileSyncUpdatePerm() { const data = enc.encode("Hello"); const filename = Deno.makeTempDirSync() + "/test.txt"; Deno.writeFileSync(filename, data, { perm: 0o755 }); - assertEqual(Deno.statSync(filename).mode & 0o777, 0o755); + assertEquals(Deno.statSync(filename).mode & 0o777, 0o755); Deno.writeFileSync(filename, data, { perm: 0o666 }); - assertEqual(Deno.statSync(filename).mode & 0o777, 0o666); + assertEquals(Deno.statSync(filename).mode & 0o777, 0o666); } }); @@ -66,8 +66,8 @@ testPerm({ read: true, write: true }, function writeFileSyncCreate() { Deno.writeFileSync(filename, data, { create: false }); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.NotFound); - assertEqual(e.name, "NotFound"); + assertEquals(e.kind, Deno.ErrorKind.NotFound); + assertEquals(e.name, "NotFound"); } assert(caughtError); @@ -77,7 +77,7 @@ testPerm({ read: true, write: true }, function writeFileSyncCreate() { const dataRead = Deno.readFileSync(filename); const dec = new TextDecoder("utf-8"); const actual = dec.decode(dataRead); - assertEqual("Hello", actual); + assertEquals("Hello", actual); }); testPerm({ read: true, write: true }, function writeFileSyncAppend() { @@ -89,17 +89,17 @@ testPerm({ read: true, write: true }, function writeFileSyncAppend() { let dataRead = Deno.readFileSync(filename); const dec = new TextDecoder("utf-8"); let actual = dec.decode(dataRead); - assertEqual("HelloHello", actual); + assertEquals("HelloHello", actual); // Now attempt overwrite Deno.writeFileSync(filename, data, { append: false }); dataRead = Deno.readFileSync(filename); actual = dec.decode(dataRead); - assertEqual("Hello", actual); + assertEquals("Hello", actual); // append not set should also overwrite Deno.writeFileSync(filename, data); dataRead = Deno.readFileSync(filename); actual = dec.decode(dataRead); - assertEqual("Hello", actual); + assertEquals("Hello", actual); }); testPerm({ read: true, write: true }, async function writeFileSuccess() { @@ -110,7 +110,7 @@ testPerm({ read: true, write: true }, async function writeFileSuccess() { const dataRead = Deno.readFileSync(filename); const dec = new TextDecoder("utf-8"); const actual = dec.decode(dataRead); - assertEqual("Hello", actual); + assertEquals("Hello", actual); }); testPerm({ read: true, write: true }, async function writeFileNotFound() { @@ -123,8 +123,8 @@ testPerm({ read: true, write: true }, async function writeFileNotFound() { await Deno.writeFile(filename, data); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.NotFound); - assertEqual(e.name, "NotFound"); + assertEquals(e.kind, Deno.ErrorKind.NotFound); + assertEquals(e.name, "NotFound"); } assert(caughtError); }); @@ -139,8 +139,8 @@ testPerm({ read: true, write: false }, async function writeFilePerm() { await Deno.writeFile(filename, data); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.PermissionDenied); - assertEqual(e.name, "PermissionDenied"); + assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(e.name, "PermissionDenied"); } assert(caughtError); }); @@ -151,9 +151,9 @@ testPerm({ read: true, write: true }, async function writeFileUpdatePerm() { const data = enc.encode("Hello"); const filename = Deno.makeTempDirSync() + "/test.txt"; await Deno.writeFile(filename, data, { perm: 0o755 }); - assertEqual(Deno.statSync(filename).mode & 0o777, 0o755); + assertEquals(Deno.statSync(filename).mode & 0o777, 0o755); await Deno.writeFile(filename, data, { perm: 0o666 }); - assertEqual(Deno.statSync(filename).mode & 0o777, 0o666); + assertEquals(Deno.statSync(filename).mode & 0o777, 0o666); } }); @@ -167,8 +167,8 @@ testPerm({ read: true, write: true }, async function writeFileCreate() { await Deno.writeFile(filename, data, { create: false }); } catch (e) { caughtError = true; - assertEqual(e.kind, Deno.ErrorKind.NotFound); - assertEqual(e.name, "NotFound"); + assertEquals(e.kind, Deno.ErrorKind.NotFound); + assertEquals(e.name, "NotFound"); } assert(caughtError); @@ -178,7 +178,7 @@ testPerm({ read: true, write: true }, async function writeFileCreate() { const dataRead = Deno.readFileSync(filename); const dec = new TextDecoder("utf-8"); const actual = dec.decode(dataRead); - assertEqual("Hello", actual); + assertEquals("Hello", actual); }); testPerm({ read: true, write: true }, async function writeFileAppend() { @@ -190,15 +190,15 @@ testPerm({ read: true, write: true }, async function writeFileAppend() { let dataRead = Deno.readFileSync(filename); const dec = new TextDecoder("utf-8"); let actual = dec.decode(dataRead); - assertEqual("HelloHello", actual); + assertEquals("HelloHello", actual); // Now attempt overwrite await Deno.writeFile(filename, data, { append: false }); dataRead = Deno.readFileSync(filename); actual = dec.decode(dataRead); - assertEqual("Hello", actual); + assertEquals("Hello", actual); // append not set should also overwrite await Deno.writeFile(filename, data); dataRead = Deno.readFileSync(filename); actual = dec.decode(dataRead); - assertEqual("Hello", actual); + assertEquals("Hello", actual); }); diff --git a/tests/fetch_deps.ts b/tests/fetch_deps.ts index 14f1feb8f8..08743e36b2 100644 --- a/tests/fetch_deps.ts +++ b/tests/fetch_deps.ts @@ -1,5 +1,5 @@ // Run ./tools/http_server.py too in order for this test to run. -import { assert } from "../js/deps/https/deno.land/std/testing/mod.ts"; +import { assert } from "../js/deps/https/deno.land/std/testing/asserts.ts"; // TODO Top level await https://github.com/denoland/deno/issues/471 async function main() { diff --git a/website/app_test.js b/website/app_test.js index 3ee2c7082e..b6845a0f73 100644 --- a/website/app_test.js +++ b/website/app_test.js @@ -1,6 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, testPerm, assert, assertEqual } from "../js/test_util.ts"; +import { test, testPerm, assert, assertEquals } from "../js/test_util.ts"; import { createBinarySizeColumns, createExecTimeColumns, @@ -134,7 +134,7 @@ const irregularData = [ test(function createExecTimeColumnsRegularData() { const columns = createExecTimeColumns(regularData); - assertEqual(columns, [ + assertEquals(columns, [ ["hello", 0.05, 0.055], ["relative_import", 0.06, 0.065], ["cold_hello", 0.05, 0.055], @@ -144,7 +144,7 @@ test(function createExecTimeColumnsRegularData() { test(function createExecTimeColumnsIrregularData() { const columns = createExecTimeColumns(irregularData); - assertEqual(columns, [ + assertEquals(columns, [ ["hello", null, null], ["relative_import", null, null], ["cold_hello", null, null], @@ -154,7 +154,7 @@ test(function createExecTimeColumnsIrregularData() { test(function createBinarySizeColumnsRegularData() { const columns = createBinarySizeColumns(regularData); - assertEqual(columns, [ + assertEquals(columns, [ ["deno", 100000000, 100000001], ["main.js", 90000000, 90000001], ["main.js.map", 80000000, 80000001], @@ -164,30 +164,30 @@ test(function createBinarySizeColumnsRegularData() { test(function createBinarySizeColumnsIrregularData() { const columns = createBinarySizeColumns(irregularData); - assertEqual(columns, [["deno", null, 1]]); + assertEquals(columns, [["deno", null, 1]]); }); test(function createThreadCountColumnsRegularData() { const columns = createThreadCountColumns(regularData); - assertEqual(columns, [["set_timeout", 4, 5], ["fetch_deps", 6, 7]]); + assertEquals(columns, [["set_timeout", 4, 5], ["fetch_deps", 6, 7]]); }); test(function createThreadCountColumnsIrregularData() { const columns = createThreadCountColumns(irregularData); - assertEqual(columns, [["set_timeout", null, 5], ["fetch_deps", null, 7]]); + assertEquals(columns, [["set_timeout", null, 5], ["fetch_deps", null, 7]]); }); test(function createSyscallCountColumnsRegularData() { const columns = createSyscallCountColumns(regularData); - assertEqual(columns, [["hello", 600, 700], ["fetch_deps", 700, 800]]); + assertEquals(columns, [["hello", 600, 700], ["fetch_deps", 700, 800]]); }); test(function createSyscallCountColumnsIrregularData() { const columns = createSyscallCountColumns(irregularData); - assertEqual(columns, [["hello", null, 700], ["fetch_deps", null, 800]]); + assertEquals(columns, [["hello", null, 700], ["fetch_deps", null, 800]]); }); test(function createSha1ListRegularData() { const sha1List = createSha1List(regularData); - assertEqual(sha1List, ["abcdef", "012345"]); + assertEquals(sha1List, ["abcdef", "012345"]); }); diff --git a/website/manual.md b/website/manual.md index 3767a2e013..9d19a15e02 100644 --- a/website/manual.md +++ b/website/manual.md @@ -432,16 +432,16 @@ uses a URL to import a test runner library: ```ts import { test, - assertEqual, + assertEquals, runIfMain } from "https://deno.land/std/testing/mod.ts"; test(function t1() { - assertEqual("hello", "hello"); + assertEquals("hello", "hello"); }); test(function t2() { - assertEqual("world", "world"); + assertEquals("world", "world"); }); runIfMain(import.meta); @@ -497,14 +497,14 @@ testing library across a large project. Rather than importing `package.ts` file the exports the third-party code: ```ts -export { test, assertEqual } from "https://deno.land/std/testing/mod.ts"; +export { test, assertEquals } from "https://deno.land/std/testing/mod.ts"; ``` And throughout project one can import from the `package.ts` and avoid having many references to the same URL: ```ts -import { test, assertEqual } from "./package.ts"; +import { test, assertEquals } from "./package.ts"; ``` This design circumvents a plethora of complexity spawned by package management diff --git a/website/style.css b/website/style.css index f11f7e2ea3..b00997e2ca 100644 --- a/website/style.css +++ b/website/style.css @@ -100,4 +100,4 @@ code { .hljs { background: transparent; -} \ No newline at end of file +}