Skip to content

Instantly share code, notes, and snippets.

// The entry file of your WebAssembly module.
class OnlyHasUnchecked {
length: i32 = 3;
@operator("{}")
protected __get(index: i32): i32 {
return index;
}
}

Keybase proof

I hereby claim:

  • I am jtenner on github.

  • I am devilmint (https://keybase.io/devilmint) on keybase.

  • I have a public key ASAd8zM4Uwfwh1TpXx0o5g-db62_yJOXSjstwI5i_Cw6Ywo

(module
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$v (func))
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$vii (func (param i32 i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$viii (func (param i32 i32 i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$vdii (func (param f64 i32 i32)))
import { SetTransformOperation } from "../internal/operations/SetTransformOperation";
import { CanvasContext2DInstructionType } from "../../src/shared/CanvasContext2DInstructionType";
describe("SetTransformOperation", () => {
it("should write to a buffer", () => {
// Create an array buffer with the size of a SetTransformOperation
let buffer = new ArrayBuffer(offsetof<SetTransformOperation>());
// write to the buffer at index 0
let nextIndex = SetTransformOperation.write(buffer, 0, 1, 2, 3, 4, 5, 6);
class Vec3 {
x: f64;
y: f64;
z: f64;
}
const refPointer: usize = __alloc(5000);
const a = new Vec3();
const b = changetype<Vec3>(refPointer);
describe("A failing test", (): void => {
it("should fail", (): void => {
expect<bool>(false).toBeTruthy("Show this message, because we expect a falsy value to be truthy!");
});
});
class Vec3 {
constructor(
public x: f64,
public y: f64,
public z: f64,
) {}
}
let a = new Vec3(1.0, 2.0, 3.0);
describe("not", (): void => {
it("should not be -1", (): void => {
expect<i32>(42).not.toBe(-1, "42 is not -1");
});
});
class Vec3 {
x: f64 = 0;
y: f64 = 0;
z: f64 = 0;
}
describe("Vec3", (): void => {
it("should add up", (): void => {
expect<i32>(19 + 23).toBe(42);
});
class Bar {}
describe("Foo", (): void => {
log<string>("Some string value");
log<i32>(42); // all number types are supported
log<Bar>(new Bar()); // displays the raw bytes in the console
log<Bar>(null); // null reference
});