mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 09:32:41 +00:00
feat: tests
This commit is contained in:
83
packages/easy-ast/test/project/ineritance.ast-test.ts
Normal file
83
packages/easy-ast/test/project/ineritance.ast-test.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars,@typescript-eslint/no-inferrable-types */
|
||||
/*
|
||||
* Copyright (C) 2021 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {EasyAstSpecType} from '../easy-ast-spec-type.js';
|
||||
import {LightweightDefinitionKind} from '../../src/index.js';
|
||||
|
||||
interface $BaseInterface<T> {
|
||||
foo: T;
|
||||
}
|
||||
|
||||
interface $BaseInterface2 {
|
||||
bar: string;
|
||||
}
|
||||
|
||||
class $BaseClass {}
|
||||
|
||||
// @ts-expect-error unused
|
||||
class InheritingClass extends $BaseClass implements $BaseInterface<number>, $BaseInterface2 {
|
||||
bar: string = '';
|
||||
|
||||
foo: number = 1;
|
||||
}
|
||||
|
||||
export const testConfig: EasyAstSpecType = {
|
||||
testName: `inheritance`,
|
||||
expected: {
|
||||
InheritingClass: {
|
||||
name: 'InheritingClass',
|
||||
kind: LightweightDefinitionKind.CLASS_LIKE,
|
||||
modifiers: ['class'],
|
||||
implementedDefinitions: [
|
||||
{
|
||||
referenceName: '$BaseInterface',
|
||||
genericsTypes: [
|
||||
{
|
||||
value: 'number',
|
||||
flags: 8,
|
||||
},
|
||||
],
|
||||
flags: 524_288,
|
||||
},
|
||||
{
|
||||
referenceName: '$BaseInterface2',
|
||||
flags: 524_288,
|
||||
},
|
||||
],
|
||||
extendedDefinitions: [
|
||||
{
|
||||
referenceName: '$BaseClass',
|
||||
flags: 524_288,
|
||||
},
|
||||
],
|
||||
properties: {
|
||||
foo: {
|
||||
name: 'foo',
|
||||
type: {
|
||||
value: 'number',
|
||||
flags: 8,
|
||||
},
|
||||
},
|
||||
bar: {
|
||||
name: 'bar',
|
||||
type: {
|
||||
value: 'string',
|
||||
flags: 4,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user