-
-
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
9c0de9f
commit a9b670b
Showing
3 changed files
with
99 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* @file Type Tests - CatchClause | ||
* @module esast/nodes/tests/unit-d/CatchClause | ||
*/ | ||
|
||
import type { | ||
BlockStatement, | ||
Data, | ||
Parent, | ||
Pattern | ||
} from '@flex-development/esast' | ||
import type { Nullable, Optional } from '@flex-development/tutils' | ||
import type * as TestSubject from '../catch-clause' | ||
|
||
describe('unit-d:nodes/CatchClause', () => { | ||
type Subject = TestSubject.default | ||
type SubjectData = TestSubject.CatchClauseData | ||
|
||
it('should extend Parent', () => { | ||
expectTypeOf<Subject>().toMatchTypeOf<Parent>() | ||
}) | ||
|
||
it('should match [children: [Nullable<Pattern>, BlockStatement]]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('children') | ||
.toEqualTypeOf<[Nullable<Pattern>, BlockStatement]>() | ||
}) | ||
|
||
it('should match [data?: Optional<CatchClauseData>]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('data') | ||
.toEqualTypeOf<Optional<SubjectData>>() | ||
}) | ||
|
||
it('should match [type: "catchClause"]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('type') | ||
.toEqualTypeOf<'catchClause'>() | ||
}) | ||
|
||
describe('CatchClauseData', () => { | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* @file Nodes - CatchClause | ||
* @module esast/nodes/CatchClause | ||
*/ | ||
|
||
import type { | ||
BlockStatement, | ||
Data, | ||
Parent, | ||
Pattern | ||
} from '@flex-development/esast' | ||
import type { Nullable, Optional } from '@flex-development/tutils' | ||
|
||
/** | ||
* Info associated with `catch` clauses. | ||
* | ||
* @see {@linkcode Data} | ||
* | ||
* @extends {Data} | ||
*/ | ||
interface CatchClauseData extends Data {} | ||
|
||
/** | ||
* A `catch` clause. | ||
* | ||
* @see {@linkcode Parent} | ||
* | ||
* @extends {Parent} | ||
*/ | ||
interface CatchClause extends Parent { | ||
/** | ||
* List of children. | ||
* | ||
* @see {@linkcode BlockStatement} | ||
* @see {@linkcode Pattern} | ||
*/ | ||
children: [param: Nullable<Pattern>, body: BlockStatement] | ||
|
||
/** | ||
* Info from the ecosystem. | ||
* | ||
* @see {@linkcode CatchClauseData} | ||
*/ | ||
data?: Optional<CatchClauseData> | ||
|
||
/** | ||
* Node type. | ||
*/ | ||
type: 'catchClause' | ||
} | ||
|
||
export type { CatchClauseData, CatchClause as default } |
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