Skip to content

Commit

Permalink
Update token.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanThatOneKid committed Dec 8, 2021
1 parent b2bd98d commit 0163e07
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions lib/tokenize/token.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
// TODO(@ethandavidson): test `is` method
// TODO(@ethandavidson): test `getKindOf` method
// TODO(@ethandavidson): test `toString` method
// TODO(@ethandavidson): test `value` method

import { assertEquals } from "../../deps/std/testing.ts";
import { assert, assertEquals } from "../../deps/std/testing.ts";
import { Token } from "./token.ts";
import { Lexicon } from "./lexicon.ts";

Deno.test("creates a token with an empty string without crashing", () => {
assertEquals(new Token("").kind, Lexicon.Unknown);
});

Deno.test("tokens can be accurately classified", () => {
assert(new Token("").is(Lexicon.Unknown));
});

Deno.test("raw strings can be accurately classified as a kind of token", () => {
assertEquals(Token.getKindOf(""), Lexicon.Unknown);
});

Deno.test("inherits the value of a token from its raw value", () => {
assertEquals(new Token("type").value, "type");
});

Deno.test("tokens are stringified based on their computed value property", () => {
assertEquals(new Token("type").toString(), "type");
});

1 comment on commit 0163e07

@deno-deploy
Copy link

@deno-deploy deno-deploy bot commented on 0163e07 Dec 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to deploy:

failed to fetch 'https://raw.githubusercontent.com/EthanThatOneKid/fart/0163e0760464239142980fc0134781b7a860496d/std/server/worker.ts': HTTP status client error (404 Not Found) for url (https://raw.githubusercontent.com/EthanThatOneKid/fart/0163e0760464239142980fc0134781b7a860496d/std/server/worker.ts)

Please sign in to comment.