summaryrefslogtreecommitdiff
path: root/std/testing/mod.ts
diff options
context:
space:
mode:
authorYusuke Sakurai <kerokerokerop@gmail.com>2020-02-07 16:23:38 +0900
committerGitHub <noreply@github.com>2020-02-07 02:23:38 -0500
commitc2986891f6aac87cec98232735945af756e6643f (patch)
tree716dc739f438bf740fa960b87fc022d569090802 /std/testing/mod.ts
parentea6179f7dce89416f1586ee18c2f437e68eabd38 (diff)
remove non-null assertion operator from std (part1) (#3900)
Diffstat (limited to 'std/testing/mod.ts')
-rw-r--r--std/testing/mod.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/std/testing/mod.ts b/std/testing/mod.ts
index 16eae5ebe..a60e9c93f 100644
--- a/std/testing/mod.ts
+++ b/std/testing/mod.ts
@@ -261,11 +261,14 @@ function printResults(
}
function previousPrinted(name: string, results: TestResults): boolean {
- const curIndex: number = results.keys.get(name)!;
+ const curIndex = results.keys.get(name);
+ assert(curIndex != null);
if (curIndex === 0) {
return true;
}
- return results.cases.get(curIndex - 1)!.printed;
+ const prev = results.cases.get(curIndex - 1);
+ assert(prev != null);
+ return prev.printed;
}
async function createTestCase(
@@ -274,7 +277,10 @@ async function createTestCase(
exitOnFail: boolean,
{ fn, name }: TestDefinition
): Promise<void> {
- const result: TestResult = results.cases.get(results.keys.get(name)!)!;
+ const i = results.keys.get(name);
+ assert(i != null);
+ const result = results.cases.get(i);
+ assert(result != null);
try {
const start = performance.now();
await fn();