mirror of
https://github.com/Noratrieb/riverdelta.git
synced 2026-01-14 16:35:03 +01:00
fix tests
This commit is contained in:
parent
e455e71aa2
commit
309a286a1a
2 changed files with 41 additions and 11 deletions
|
|
@ -4,44 +4,62 @@ exports[`should tokenize an emtpy function 1`] = `
|
|||
[
|
||||
{
|
||||
"kind": "function",
|
||||
"span": {
|
||||
"span": Span {
|
||||
"end": 8,
|
||||
"file": {
|
||||
"content": "function hello() = ;",
|
||||
},
|
||||
"start": 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
"ident": "hello",
|
||||
"kind": "identifier",
|
||||
"span": {
|
||||
"span": Span {
|
||||
"end": 14,
|
||||
"file": {
|
||||
"content": "function hello() = ;",
|
||||
},
|
||||
"start": 9,
|
||||
},
|
||||
},
|
||||
{
|
||||
"kind": "(",
|
||||
"span": {
|
||||
"span": Span {
|
||||
"end": 15,
|
||||
"file": {
|
||||
"content": "function hello() = ;",
|
||||
},
|
||||
"start": 14,
|
||||
},
|
||||
},
|
||||
{
|
||||
"kind": ")",
|
||||
"span": {
|
||||
"span": Span {
|
||||
"end": 16,
|
||||
"file": {
|
||||
"content": "function hello() = ;",
|
||||
},
|
||||
"start": 15,
|
||||
},
|
||||
},
|
||||
{
|
||||
"kind": "=",
|
||||
"span": {
|
||||
"span": Span {
|
||||
"end": 18,
|
||||
"file": {
|
||||
"content": "function hello() = ;",
|
||||
},
|
||||
"start": 17,
|
||||
},
|
||||
},
|
||||
{
|
||||
"kind": ";",
|
||||
"span": {
|
||||
"span": Span {
|
||||
"end": 20,
|
||||
"file": {
|
||||
"content": "function hello() = ;",
|
||||
},
|
||||
"start": 19,
|
||||
},
|
||||
},
|
||||
|
|
@ -53,30 +71,42 @@ exports[`should tokenize hello world 1`] = `
|
|||
{
|
||||
"ident": "print",
|
||||
"kind": "identifier",
|
||||
"span": {
|
||||
"span": Span {
|
||||
"end": 5,
|
||||
"file": {
|
||||
"content": "print("hello world")",
|
||||
},
|
||||
"start": 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
"kind": "(",
|
||||
"span": {
|
||||
"span": Span {
|
||||
"end": 6,
|
||||
"file": {
|
||||
"content": "print("hello world")",
|
||||
},
|
||||
"start": 5,
|
||||
},
|
||||
},
|
||||
{
|
||||
"kind": "lit_string",
|
||||
"span": {
|
||||
"span": Span {
|
||||
"end": 19,
|
||||
"file": {
|
||||
"content": "print("hello world")",
|
||||
},
|
||||
"start": 6,
|
||||
},
|
||||
"value": "hello world",
|
||||
},
|
||||
{
|
||||
"kind": ")",
|
||||
"span": {
|
||||
"span": Span {
|
||||
"end": 20,
|
||||
"file": {
|
||||
"content": "print("hello world")",
|
||||
},
|
||||
"start": 19,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { lines } from "./error";
|
|||
it("should extract lines correctly", () => {
|
||||
const input = "AAA\nmeow\n:3\n\n";
|
||||
|
||||
const lineSpans = lines(input);
|
||||
const lineSpans = lines({ content: input });
|
||||
const lineContents = lineSpans.map(({ start, end }) =>
|
||||
input.slice(start, end)
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue