Skip to content

Commit

Permalink
Test symbol properties directly, for union
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderOMara committed Dec 19, 2024
1 parent af5d7ba commit 7bf2f32
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions union.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,31 @@ Deno.test('Union: private properties', () => {
assertEquals(test.getAlpha(), 42);
});

Deno.test('Struct: symbol properties', () => {
const symPub = Symbol('public');
const symPro = Symbol('protected');
const symPri = Symbol('private');

class Test extends Union {
declare public [symPub]: number;

declare protected [symPro]: number;

declare private [symPri]: number;

static {
int8(this, symPub);
int8(this, symPro as never);
int8(this, symPri as never);
}
}

const test = new Test(new Uint8Array([123]).buffer);
assertEquals(test[symPub], 123);
assertEquals(test[symPro], 123);
assertEquals(test[symPri], 123);
});

Deno.test('Union: extends', () => {
class One extends Union {
declare public one: number;
Expand Down

0 comments on commit 7bf2f32

Please sign in to comment.