Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for ucode #881

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions lexers/testdata/ucode.actual
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env ucode

import { open } from "fs";
import * as o from "fs";

// This is a comment on a line of its own.
function abcd(x, ...values) {
print(...values, "\n");
return null;
}

let x_5 = 5; // This is a comment on a line of code.

let id = x => x;
let empty = () => 0;
let add = (a, b) => a + b;

if (true) {
abcd(0);
} else if (false) {
abcd("a");
} else {
abcd([0, 1, 2]);
}

for (let i in [0, 1, 2]) {
}

for (let i = 0; i < 10; i++) {
}

let count = 5;
while (count--) {
continue;
}

switch (x) {
case 6:
x = 8.8;
break;
default:
x = -9.7e2;
}

try {
die("");
} catch {
}

match("foobarbaz", /b.(.)/)

let obj = {a: abcd, b: -1, c: (x) => 2*x, d: [], e: {}, f: function(n) {return this;}};
delete obj.a;

let a = Infinity;
let b = NaN;
let c = "abc";
let d = 'abc';
let e = `aaa ${id(5)} bbb \u2600`;

export id;
Loading
Loading