Merge pull request #11 from tarunsamanta2k20/tarun_samanta/#7

Change `// test_output! output` to `//! test_output(output)`
This commit is contained in:
Andrew Morris
2023-05-31 12:32:28 +10:00
committed by GitHub
124 changed files with 136 additions and 130 deletions

View File

@@ -1,4 +1,4 @@
// test_output! [1, 2, 3, 12586269025]
//! test_output([1, 2, 3, 12586269025])
export @main {}

View File

@@ -1,4 +1,4 @@
// test_output! 1
//! test_output(1)
// (Should be 0.)
export default function main() {

View File

@@ -1,4 +1,4 @@
// test_output! [["1.20e+2","1.22e+2","1.22e+2","1.24e+2","1.24e+2"],["1.21e+0","1.22e+0","1.23e+0","1.24e+0","1.25e+0"]]
//! test_output([["1.20e+2","1.22e+2","1.22e+2","1.24e+2","1.24e+2"],["1.21e+0","1.22e+0","1.23e+0","1.24e+0","1.25e+0"]])
// This is wrong. There's some inconsistent banker's rounding going on.
// It appears to be inherent to rust's {:.*e} formatting - a technical oversight?
// Or maybe it has to do with parsing the source string into a number imprecisely?

View File

@@ -1,4 +1,4 @@
// test_output! "Done"
//! test_output("Done")
export default function () {
return "Done";

View File

@@ -1,4 +1,4 @@
// test_output! [true,false,false,[1,2,3],["a","b","c"],[],[1,2,3],[],[,,],[3,1],[true]]
//! test_output([true,false,false,[1,2,3],["a","b","c"],[],[1,2,3],[],[,,],[3,1],[true]])
export default function () {
return [

View File

@@ -1,4 +1,4 @@
// test_output! {"left":"right"}
//! test_output({"left":"right"})
export default function main() {
let x = {} as any;

View File

@@ -1,4 +1,4 @@
// test_output! ["a","b"]
//! test_output(["a","b"])
export default function main() {
let log = [];

View File

@@ -1,4 +1,4 @@
// test_output! [Symbol.iterator,{},3]
//! test_output([Symbol.iterator,{},3])
export default function main() {
const x = { [Symbol.iterator]: 3 };

View File

@@ -1,4 +1,4 @@
// test_output! E: TypeError{"message":"Cannot mix BigInt and other types"}
//! test_output(E: TypeError{"message":"Cannot mix BigInt and other types"})
export default function () {
return 1 + (1n as unknown as number);

View File

@@ -1,4 +1,4 @@
// test_output! [[1,2,5],[1,2,3,4,5]]
//! test_output([[1,2,5],[1,2,3,4,5]])
export default function main() {
let tree = BinaryTree();

View File

@@ -1,4 +1,4 @@
// test_output! [true,false,false,true,true,true,true,false,true,false,false,false]
//! test_output([true,false,false,true,true,true,true,false,true,false,false,false])
export default function () {
return [

View File

@@ -1,4 +1,4 @@
// test_output! [1,6,17]
//! test_output([1,6,17])
export default function () {
const poly = buildPoly([1, 2, 3]); // 1 + 2*x + 3*x^2

View File

@@ -1,4 +1,4 @@
// test_output! 3
//! test_output(3)
export default function main() {
function foo() {

View File

@@ -1,4 +1,4 @@
// test_output! 7
//! test_output(7)
export default function main() {
function foo() {

View File

@@ -1,4 +1,4 @@
// test_output! ["c","a","b"]
//! test_output(["c","a","b"])
export default function main() {
let log = [];

View File

@@ -1,4 +1,4 @@
// test_output! 37
//! test_output(37)
export default function () {
const foo = new Foo();

View File

@@ -1,4 +1,4 @@
// test_output! E: TypeError{"message":"Cannot mutate this because it is const"}
//! test_output(E: TypeError{"message":"Cannot mutate this because it is const"})
export default function () {
const arr = [1, 2];

View File

@@ -1,4 +1,4 @@
// test_output! E: TypeError{"message":"Cannot mutate this because it is const"}
//! test_output(E: TypeError{"message":"Cannot mutate this because it is const"})
export default function () {
const foo = new Foo();

View File

@@ -1,4 +1,4 @@
// test_output! E: TypeError{"message":"Cannot mutate this because it is const"}
//! test_output(E: TypeError{"message":"Cannot mutate this because it is const"})
export default function () {
const foo = new Foo();

View File

@@ -1,4 +1,4 @@
// test_output! [1,2,3]
//! test_output([1,2,3])
export default function main() {
let c = Counter();

View File

@@ -1,4 +1,4 @@
// test_output! [5,6,7,8,9]
//! test_output([5,6,7,8,9])
export default function () {
let vals: number[] = [];

View File

@@ -1,4 +1,4 @@
// test_output! 3
//! test_output(3)
export default function main() {
const [a, b] = [1, 2];

View File

@@ -1,4 +1,4 @@
// test_ouput! 42
//! test_output(42)
export default function main() {
const [[[{ x: { y: [[{ z }]] } }]]] = [[[{ x: { y: [[{ z: 42 }]] } }]]];

View File

@@ -1,4 +1,4 @@
// test_output! [55,145,237,43,31]
//! test_output([55,145,237,43,31])
export default function main() {
let res = [];

View File

@@ -1,4 +1,4 @@
// test_output! 3
//! test_output(3)
export default function main() {
const { a, b } = { a: 1, b: 2 };

View File

@@ -1,4 +1,4 @@
// test_output! 3
//! test_output(3)
export default function main() {
return foo([1, 2]);

View File

@@ -1,4 +1,4 @@
// test_ouput! 42
//! test_output(42)
export default function main() {
return foo([[[{ x: { y: [[{ z: 42 }]] } }]]]);

View File

@@ -1,4 +1,4 @@
// test_output! [55,145,237,43,31]
//! test_output([55,145,237,43,31])
export default function main() {
return [

View File

@@ -1,4 +1,4 @@
// test_output! 3
//! test_output(3)
export default function main() {
return foo({ a: 1, b: 2 });

View File

@@ -1,4 +1,4 @@
// test_output! undefined
//! test_output(undefined)
export default function () {
try {

View File

@@ -1,4 +1,4 @@
// test_output! 3
//! test_output(3)
export default function main() {
let x = 0;

View File

@@ -1,4 +1,4 @@
// test_output! 8
//! test_output(8)
export default function () {
try {

View File

@@ -1,4 +1,4 @@
// test_output!: "Caught: boom"
//! test_output("Caught: boom")
export default function () {
try {

View File

@@ -1,4 +1,4 @@
// test_output! "🤷‍♂️"
//! test_output("🤷‍♂️")
export default function () {
while (true) {

View File

@@ -1,4 +1,4 @@
// test_output! "that thing"
//! test_output("that thing")
export default function () {
while (true) {

View File

@@ -1,4 +1,4 @@
// test_output! 42
//! test_output(42)
export default function () {
try {

View File

@@ -1,4 +1,4 @@
// test_output! "Ok"
//! test_output("Ok")
export default function () {
let result: string;

View File

@@ -1,4 +1,4 @@
// test_output! "that thing"
//! test_output("that thing")
export default function () {
while (true) {

View File

@@ -1,4 +1,4 @@
// test_error! ["outer finally",Error{"message":"inner finally"}]
//! test_error(["outer finally",Error{"message":"inner finally"}])
export default function () {
let logs: unknown[] = [];

View File

@@ -1,4 +1,4 @@
// test_output! "this thing"
//! test_output("this thing")
export default function () {
while (true) {

View File

@@ -1,4 +1,4 @@
// test_error! Error{"message":"nested error"}
//! test_error(Error{"message":"nested error"})
export default function () {
try {

View File

@@ -1,4 +1,4 @@
// test_output! ["boom"]
//! test_output(["boom"])
//
// Note: the original intention was for this to output ["here","nested boom","boom"] to check where
// the control flow goes. This worked at the time, but now that snapshotting variables that can be

View File

@@ -1,4 +1,4 @@
// test_output! [[],["item"]]
//! test_output([[],["item"]])
export default function () {
return [

View File

@@ -1,4 +1,4 @@
// test_output! [0,1]
//! test_output([0,1])
export default function () {
return [

View File

@@ -1,4 +1,4 @@
// test_output! [1,3,"SmallQueue is already full"]
//! test_output([1,3,"SmallQueue is already full"])
export default function () {
let a = new SmallQueue(["item1"]);

View File

@@ -1,4 +1,4 @@
// test_error! E: {"code":"400","message":"Bad request"}
//! test_error(E: {"code":"400","message":"Bad request"})
export default function () {
throw new CustomError(400, "Bad request");

View File

@@ -1,4 +1,4 @@
// test_error! Error{"message":"Test error"}
//! test_error(Error{"message":"Test error"})
export default function () {
throw new Error("Test error");

View File

@@ -1,4 +1,4 @@
// test_error! E: TypeError{"message":"Cannot subscript undefined"}
//! test_error(E: TypeError{"message":"Cannot subscript undefined"})
export default function () {
const arr = undefined;

View File

@@ -1,4 +1,4 @@
// test_output! Error{"message":"Something went wrong"}
//! test_output(Error{"message":"Something went wrong"})
export default function () {
try {

View File

@@ -1,4 +1,4 @@
// test_output! E: Error{"message":"teraboom"}
//! test_output(E: Error{"message":"teraboom"})
export default function () {
try {

View File

@@ -1,4 +1,4 @@
// test_error! E: ["rethrow",Error{"message":"Something went wrong"}]
//! test_error(E: ["rethrow",Error{"message":"Something went wrong"}])
export default function () {
try {

View File

@@ -1,4 +1,4 @@
// test_output! E: Error{"message":"Something went wrong"}
//! test_output(E: Error{"message":"Something went wrong"})
export default function () {
try {

View File

@@ -1,4 +1,4 @@
// test_output! 42
//! test_output(42)
export default function () {
try {

View File

@@ -1,4 +1,4 @@
// test_output! [1,4,9]
//! test_output([1,4,9])
export default function () {
let vals: number[] = [];

View File

@@ -1,4 +1,4 @@
// test_output! "Hello world!"
//! test_output("Hello world!")
export default function main() {
return 'Hello world!';

View File

@@ -1,4 +1,4 @@
// test_output! ["this is the bar function","this is the bar function"]
//! test_output(["this is the bar function","this is the bar function"])
import { bar, barExported } from "./helpers/bar.ts";

View File

@@ -1,4 +1,4 @@
// test_output! "this is the foo function"
//! test_output("this is the foo function")
import foo from "./helpers/foo.ts";

View File

@@ -1,4 +1,4 @@
// test_output! ["this is the foo function","this is the bar function"]
//! test_output(["this is the foo function","this is the bar function"])
import { bar, foo } from "./helpers/fooAndBar.ts";

View File

@@ -1,4 +1,4 @@
// test_output! ["this is the foo function","this is the bar function"]
//! test_output(["this is the foo function","this is the bar function"])
import foobar from "./helpers/foobar.ts";

View File

@@ -1,4 +1,4 @@
// test_output! "done"
//! test_output("done")
import { type Type } from "./helpers/Type.ts";

View File

@@ -1,4 +1,4 @@
// test_output! [[1,false],[2,false],[3,false],[undefined,true],[undefined,true]]
//! test_output([[1,false],[2,false],[3,false],[undefined,true],[undefined,true]])
export default function () {
const vals = [1, 2, 3];

View File

@@ -1,4 +1,4 @@
// test_output! [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]
//! test_output([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])
export default function main() {
const x = [7, 18, 9, 11, 16, 3, 8, 2, 5, 4, 6, 14, 15, 17, 10, 12, 1, 13];

View File

@@ -1,4 +1,4 @@
// test_output (TODO broken!) [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]
// test_output((TODO broken!) [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])
declare const Debug: {
log: (...args: unknown[]) => undefined;

View File

@@ -1,4 +1,4 @@
// test_output! [1,1]
//! test_output([1,1])
export default function main() {
let a;

View File

@@ -1,4 +1,4 @@
// test_output! [17,15,12]
//! test_output([17,15,12])
export default function main() {
let a = 2;

View File

@@ -1,4 +1,4 @@
// test_output! [[1,2,3,4],[4,3,2,1]]
//! test_output([[1,2,3,4],[4,3,2,1]])
export default function main() {
let x = [1, 2, 3, 4];

View File

@@ -1,4 +1,4 @@
// test_output! [1,4,9]
//! test_output([1,4,9])
export default function main() {
let x = 0;

View File

@@ -1,4 +1,4 @@
// test_output! [1,5,14]
//! test_output([1,5,14])
export default function main() {
let x = 0;

View File

@@ -1,4 +1,4 @@
// test_output! 3
//! test_output(3)
export default function () {
function foo() {

View File

@@ -1,4 +1,4 @@
// test_output! 3
//! test_output(3)
export default function () {
const x = 3;

View File

@@ -1,4 +1,4 @@
// test_output! [[true,true,true,true,true,true,true],[false,false,false,false,false]]
//! test_output([[true,true,true,true,true,true,true],[false,false,false,false,false]])
export default function () {
const integers = [

View File

@@ -1,4 +1,4 @@
// test_output! [[true,true,true,true,true,true],[false,false,false,false,false,false]]
//! test_output([[true,true,true,true,true,true],[false,false,false,false,false,false]])
export default function () {
const minSafe = -9007199254740991;

View File

@@ -1,4 +1,4 @@
// test_output! [[37,-37,37.1,37,37.1,1.5,0.1,1.23],[NaN]]
//! test_output([[37,-37,37.1,37,37.1,1.5,0.1,1.23],[NaN]])
export default function () {
const numbers = [

View File

@@ -1,4 +1,4 @@
// test_output! [[37,-37,15,37,37,31],[NaN,NaN]]
//! test_output([[37,-37,15,37,37,31],[NaN,NaN]])
export default function () {
const positive_and_negative = [

View File

@@ -1,4 +1,4 @@
// test_output! [["0e+0","1.2e+0","1.2e+1","1.2e+2","1.2e-1","1.2e-2","1.2e-3","1.2e-4"],["0.00e+0","1.23e+0","1.23e+1","1.23e-1","1.23e-2","1.23e-3","1.23e-4"],["NaN","Infinity"]]
//! test_output([["0e+0","1.2e+0","1.2e+1","1.2e+2","1.2e-1","1.2e-2","1.2e-3","1.2e-4"],["0.00e+0","1.23e+0","1.23e+1","1.23e-1","1.23e-2","1.23e-3","1.23e-4"],["NaN","Infinity"]])
export default function () {
const withoutPrecision = [

View File

@@ -1,4 +1,4 @@
// test_output! [["0.00","1.23","123.00","0.01","0.00123","12345.68","3.14","-1.00"],["NaN","Infinity"]]
//! test_output([["0.00","1.23","123.00","0.01","0.00123","12345.68","3.14","-1.00"],["NaN","Infinity"]])
export default function () {
const positive = [

View File

@@ -1,4 +1,4 @@
// test_output! "right"
//! test_output("right")
export default function main() {
let x;

View File

@@ -1,4 +1,4 @@
// test_output! ["c","a","b"]
//! test_output(["c","a","b"])
export default function main() {
let log: string[] = [];

View File

@@ -1,4 +1,4 @@
// test_output! 2
//! test_output(2)
export default function main() {
let value = 1;

View File

@@ -1,4 +1,4 @@
// test_output! 233168
//! test_output(233168)
export default function main() {
let sum = 0;

View File

@@ -1,4 +1,4 @@
// test_output! 70600674
//! test_output(70600674)
export default function main() {
const grid = [

View File

@@ -1,4 +1,4 @@
// test_output! "Probably 5537376230 (trailing digits: 39036)"
//! test_output("Probably 5537376230 (trailing digits: 39036)")
export default function main() {
const numStrs = [

View File

@@ -1,4 +1,4 @@
// test_output! 137846528820
//! test_output(137846528820)
export default function main() {
let rc = new RouteCalculator();

View File

@@ -1,4 +1,4 @@
// test_output! 1366
//! test_output(1366)
import plus from "./helpers/plus.ts";

View File

@@ -1,4 +1,4 @@
// test_output! 1074
//! test_output(1074)
export default function main() {
let tower = [

View File

@@ -1,4 +1,4 @@
// test_output! 171
//! test_output(171)
declare const Debug: {
log: (...args: unknown[]) => undefined;

View File

@@ -1,4 +1,4 @@
// test_output! 4613732
//! test_output(4613732)
export default function main() {
let sum = 0;

View File

@@ -1,4 +1,4 @@
// test_output! 4782
//! test_output(4782)
export default function main() {
let fibLast = 1n;

View File

@@ -1,4 +1,4 @@
// test_output! [71,839,1471,6857]
//! test_output([71,839,1471,6857])
import { factorize } from "./helpers/primes.ts";

View File

@@ -1,4 +1,4 @@
// test_output! 906609
//! test_output(906609)
export default function main() {
let largest = 0;

View File

@@ -1,4 +1,4 @@
// test_output! 232792560
//! test_output(232792560)
import { factorize } from "./helpers/primes.ts";

View File

@@ -1,4 +1,4 @@
// test_output! 25164150
//! test_output(25164150)
export default function main() {
return squareOfSum(100) - sumOfSquares(100);

View File

@@ -1,4 +1,4 @@
// test_output! 23514624000
//! test_output(23514624000)
export default function main() {
const digits = [

View File

@@ -1,4 +1,4 @@
// test_output! 31875000
//! test_output(31875000)
export default function main() {
for (let a = 1; a <= 1000; a++) {

View File

@@ -1,4 +1,4 @@
// test_output! false
//! test_output(false)
export default function main() {
const leftBowl = ["apple", "mango"];

View File

@@ -1,4 +1,4 @@
// test_output! 120
//! test_output(120)
export default function main() {
const one = 1;

View File

@@ -1,4 +1,4 @@
// test_output! 3
//! test_output(3)
export default function main() {
let sum = 0;

View File

@@ -1,4 +1,4 @@
// test_output! [".abc.",".abc.",".abc.",".abc."]
//! test_output([".abc.",".abc.",".abc.",".abc."])
export default function () {
const middle = ["a", "b", "c"] as const;

View File

@@ -1,4 +1,4 @@
// // test_output! {}
// //! test_output({})
export default function () {
let x = new X();

View File

@@ -1,4 +1,4 @@
// test_output! [undefined,"🚀","","","","🍹","","","","a","b","c","£","","한","","","🎨","","","",undefined]
//! test_output([undefined,"🚀","","","","🍹","","","","a","b","c","£","","한","","","🎨","","","",undefined])
export default function () {
const str = "🚀🍹abc£한🎨";

Some files were not shown because too many files have changed in this diff Show More