-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for typedoc-signature package
- Loading branch information
Showing
96 changed files
with
4,099 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 @@ | ||
function f() {} |
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,81 @@ | ||
import { | ||
type Entity, | ||
DeclarationEntity, | ||
} from "@onlyoffice/library-declaration/next.ts" | ||
import { | ||
EntityToken, | ||
KeywordToken, | ||
type Signature, | ||
TextToken, | ||
type Token, | ||
TypeToken, | ||
} from "@onlyoffice/signature" | ||
|
||
export const name = "computing the signature for functions without parameters" | ||
export const collection: DeclarationEntity[] = [] | ||
|
||
let e0: Entity | ||
let s: Signature = [] | ||
let t: Token | ||
|
||
e0 = new DeclarationEntity() | ||
e0.id = 2 | ||
|
||
t = new KeywordToken() | ||
t.text = "function" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = " " | ||
s.push(t) | ||
|
||
t = new EntityToken() | ||
t.text = "f" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = "(" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ")" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ": " | ||
s.push(t) | ||
|
||
t = new TypeToken() | ||
t.text = "void" | ||
s.push(t) | ||
|
||
e0.declaration.signature.verbose.push(...s) | ||
s = [] | ||
|
||
t = new TextToken() | ||
t.text = "(" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ")" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ": " | ||
s.push(t) | ||
|
||
t = new TypeToken() | ||
t.text = "void" | ||
s.push(t) | ||
|
||
e0.declaration.signature.concise.push(...s) | ||
s = [] | ||
|
||
t = new TypeToken() | ||
t.text = "void" | ||
s.push(t) | ||
|
||
e0.declaration.returns.signature.concise.push(...s) | ||
s = [] | ||
|
||
collection.push(e0) |
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,3 @@ | ||
{ | ||
"exclude": ["test.ts"] | ||
} |
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 @@ | ||
function f(p0: string): void {} |
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,112 @@ | ||
import { | ||
type Entity, | ||
DeclarationEntity, | ||
Fragment, | ||
} from "@onlyoffice/library-declaration/next.ts" | ||
import { | ||
EntityToken, | ||
KeywordToken, | ||
ParameterToken, | ||
type Signature, | ||
TextToken, | ||
type Token, | ||
TypeToken, | ||
} from "@onlyoffice/signature" | ||
|
||
export const name = "computing the signature for functions with one parameter" | ||
export const collection: DeclarationEntity[] = [] | ||
|
||
let e0: Entity | ||
let f0: Fragment | ||
let s: Signature = [] | ||
let t: Token | ||
|
||
e0 = new DeclarationEntity() | ||
e0.id = 2 | ||
|
||
f0 = new Fragment() | ||
f0.name = "p0" | ||
|
||
t = new TypeToken() | ||
t.text = "string" | ||
s.push(t) | ||
|
||
f0.signature.concise.push(...s) | ||
s = [] | ||
|
||
e0.declaration.parameters.push(f0) | ||
|
||
t = new KeywordToken() | ||
t.text = "function" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = " " | ||
s.push(t) | ||
|
||
t = new EntityToken() | ||
t.text = "f" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = "(" | ||
s.push(t) | ||
|
||
t = new ParameterToken() | ||
t.text = "p0" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ": " | ||
s.push(t) | ||
|
||
t = new TypeToken() | ||
t.text = "string" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ")" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ": " | ||
s.push(t) | ||
|
||
t = new TypeToken() | ||
t.text = "void" | ||
s.push(t) | ||
|
||
e0.declaration.signature.verbose.push(...s) | ||
s = [] | ||
|
||
t = new TextToken() | ||
t.text = "(" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = "p0" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ")" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ": " | ||
s.push(t) | ||
|
||
t = new TypeToken() | ||
t.text = "void" | ||
s.push(t) | ||
|
||
e0.declaration.signature.concise.push(...s) | ||
s = [] | ||
|
||
t = new TypeToken() | ||
t.text = "void" | ||
s.push(t) | ||
|
||
e0.declaration.returns.signature.concise.push(...s) | ||
s = [] | ||
|
||
collection.push(e0) |
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,3 @@ | ||
{ | ||
"exclude": ["test.ts"] | ||
} |
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 @@ | ||
function f(p0: string[]): void {} |
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,120 @@ | ||
import { | ||
type Entity, | ||
DeclarationEntity, | ||
Fragment, | ||
} from "@onlyoffice/library-declaration/next.ts" | ||
import { | ||
EntityToken, | ||
KeywordToken, | ||
ParameterToken, | ||
type Signature, | ||
TextToken, | ||
type Token, | ||
TypeToken, | ||
} from "@onlyoffice/signature" | ||
|
||
export const name = "computing the signature for functions with one parameter" | ||
export const collection: DeclarationEntity[] = [] | ||
|
||
let e0: Entity | ||
let f0: Fragment | ||
let s: Signature = [] | ||
let t: Token | ||
|
||
e0 = new DeclarationEntity() | ||
e0.id = 2 | ||
|
||
f0 = new Fragment() | ||
f0.name = "p0" | ||
|
||
t = new TypeToken() | ||
t.text = "string" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = "[]" | ||
s.push(t) | ||
|
||
f0.signature.concise.push(...s) | ||
s = [] | ||
|
||
e0.declaration.parameters.push(f0) | ||
|
||
t = new KeywordToken() | ||
t.text = "function" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = " " | ||
s.push(t) | ||
|
||
t = new EntityToken() | ||
t.text = "f" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = "(" | ||
s.push(t) | ||
|
||
t = new ParameterToken() | ||
t.text = "p0" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ": " | ||
s.push(t) | ||
|
||
t = new TypeToken() | ||
t.text = "string" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = "[]" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ")" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ": " | ||
s.push(t) | ||
|
||
t = new TypeToken() | ||
t.text = "void" | ||
s.push(t) | ||
|
||
e0.declaration.signature.verbose.push(...s) | ||
s = [] | ||
|
||
t = new TextToken() | ||
t.text = "(" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = "p0" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ")" | ||
s.push(t) | ||
|
||
t = new TextToken() | ||
t.text = ": " | ||
s.push(t) | ||
|
||
t = new TypeToken() | ||
t.text = "void" | ||
s.push(t) | ||
|
||
e0.declaration.signature.concise.push(...s) | ||
s = [] | ||
|
||
t = new TypeToken() | ||
t.text = "void" | ||
s.push(t) | ||
|
||
e0.declaration.returns.signature.concise.push(...s) | ||
s = [] | ||
|
||
collection.push(e0) |
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,3 @@ | ||
{ | ||
"exclude": ["test.ts"] | ||
} |
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 @@ | ||
function f(p0: string, p1: number): void {} |
Oops, something went wrong.