-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
- Loading branch information
1 parent
17ab0b9
commit 9c0de9f
Showing
5 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @file Type Tests - ThrowStatement | ||
* @module esast/nodes/tests/unit-d/ThrowStatement | ||
*/ | ||
|
||
import type { Data, Expression, Parent } from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
import type * as TestSubject from '../statement-throw' | ||
|
||
describe('unit-d:nodes/ThrowStatement', () => { | ||
type Subject = TestSubject.default | ||
type SubjectData = TestSubject.ThrowStatementData | ||
|
||
it('should extend Parent', () => { | ||
expectTypeOf<Subject>().toMatchTypeOf<Parent>() | ||
}) | ||
|
||
it('should match [children: [Expression]]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('children') | ||
.toEqualTypeOf<[Expression]>() | ||
}) | ||
|
||
it('should match [data?: Optional<ThrowStatementData>]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('data') | ||
.toEqualTypeOf<Optional<SubjectData>>() | ||
}) | ||
|
||
it('should match [type: "throwStatement"]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('type') | ||
.toEqualTypeOf<'throwStatement'>() | ||
}) | ||
|
||
describe('ThrowStatementData', () => { | ||
it('should extend Data', () => { | ||
expectTypeOf<SubjectData>().toMatchTypeOf<Data>() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* @file Nodes - ThrowStatement | ||
* @module esast/nodes/ThrowStatement | ||
*/ | ||
|
||
import type { Data, Expression, Parent } from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
|
||
/** | ||
* Info associated with `throw` statements. | ||
* | ||
* @see {@linkcode Data} | ||
* | ||
* @extends {Data} | ||
*/ | ||
interface ThrowStatementData extends Data {} | ||
|
||
/** | ||
* A `throw` statement. | ||
* | ||
* @see {@linkcode Parent} | ||
* | ||
* @extends {Parent} | ||
*/ | ||
interface ThrowStatement extends Parent { | ||
/** | ||
* List of children. | ||
* | ||
* @see {@linkcode Expression} | ||
*/ | ||
children: [argument: Expression] | ||
|
||
/** | ||
* Info from the ecosystem. | ||
* | ||
* @see {@linkcode ThrowStatementData} | ||
*/ | ||
data?: Optional<ThrowStatementData> | ||
|
||
/** | ||
* Node type. | ||
*/ | ||
type: 'throwStatement' | ||
} | ||
|
||
export type { ThrowStatementData, ThrowStatement as default } |