Skip to content

Commit

Permalink
update uix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Strehle committed Oct 12, 2024
1 parent 3cf9da3 commit e22fa64
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 56 deletions.
105 changes: 53 additions & 52 deletions uix-tests/common/datex-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,59 +8,60 @@ import { inferType, StorageSet } from 'datex-core-legacy/datex_all.ts';

const C = 0;

@sync class A {
@property a!: number;
construct() {
this.a = 42;
}
}
@sync class B extends A {
@property b!: number;
construct() {
super.construct();
this.b = 69;
}
}

const list = eternalVar("tmp1-"+C) ?? $$(new StorageSet<A>());
if (await list.getSize() === 0) {
await list.add(new A());
await list.add(new B());
}
for await (const entry of list) {
console.log(entry,entry.a, entry.b)
}
console.log("")
// @sync class A {
// @property a!: number;
// construct() {
// this.a = 42;
// }
// }
// @sync class B extends A {
// @property b!: number;
// construct() {
// super.construct();
// this.b = 69;
// }
// }

// const list = eternalVar("tmp1-"+C) ?? $$(new StorageSet<A>());
// if (await list.getSize() === 0) {
// await list.add(new A());
// await list.add(new B());
// }
// for await (const entry of list) {
// console.log(entry,entry.a, entry.b)
// }
// console.log("")

// { // Structs
// const A = struct('A',
// class {
// @property a!: number;
// construct() {
// console.log("contrucst A")
// this.a = 42;
// }
// }
// )
// type A = inferType<typeof A>;

{ // Structs
const A = struct(
class A {
@property a!: number;
construct() {
console.log("contrucst A")
this.a = 42;
}
}
)
type A = inferType<typeof A>;

// const B = struct('B',
// class extends A {
// @property b!: number;
// construct() {
// super.construct();
// this.b = 69;
// }
// }
// )
// type B = inferType<typeof B>;
// const list = eternalVar("tmp2-"+C) ?? $$(new StorageSet<A>());
// if (await list.getSize() === 0) {
// await list.add(new A());
// await list.add(new B());
// }
// for await (const entry of list) {
// console.log(entry, entry.a, entry.b)
// }
// }
const B = struct(
class Bee extends A {
@property b!: number;
construct() {
super.construct();
this.b = 69;
}
}
)
type B = inferType<typeof B>;
const list = eternalVar("tmp2-"+C) ?? $$(new StorageSet<A>());
if (await list.getSize() === 0) {
await list.add(new A());
await list.add(new B());
}
for await (const entry of list) {
console.log(entry, entry.a, entry.b)
}
}
11 changes: 7 additions & 4 deletions uix-tests/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e22fa64

Please sign in to comment.