Skip to content

Commit

Permalink
tests: accept baselines
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsdev committed Oct 14, 2022
1 parent 47e55a2 commit c50fe96
Show file tree
Hide file tree
Showing 18 changed files with 124 additions and 34 deletions.
2 changes: 1 addition & 1 deletion tests/baselines/reference/array.tree
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
=== array.ts ===

type arrayOfStrings = string[]
> arrayOfStrings --- {"kind":"array","type":{"kind":"primitive","primitive":"string","id":15},"symbolMeta":{"name":"arrayOfStrings","flags":524288},"aliasSymbolMeta":{"name":"arrayOfStrings","flags":524288},"id":86}
> arrayOfStrings --- {"kind":"array","type":{"kind":"primitive","primitive":"string","id":15},"symbolMeta":{"name":"arrayOfStrings","flags":524288},"id":86}
6 changes: 3 additions & 3 deletions tests/baselines/reference/arrayObjectAlias.tree
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== arrayObjectAlias.ts ===

type Obj = { a: string, b: number }
> Obj --- {"kind":"object","properties":[{"kind":"primitive","primitive":"string","symbolMeta":{"name":"a","flags":4},"id":15},{"kind":"primitive","primitive":"number","symbolMeta":{"name":"b","flags":4},"id":16}],"indexInfos":[],"symbolMeta":{"name":"Obj","flags":524288},"aliasSymbolMeta":{"name":"Obj","flags":524288},"id":86}
> Obj --- {"kind":"object","properties":[{"kind":"primitive","primitive":"string","symbolMeta":{"name":"a","flags":4},"id":15},{"kind":"primitive","primitive":"number","symbolMeta":{"name":"b","flags":4},"id":16}],"indexInfos":[],"symbolMeta":{"name":"Obj","flags":524288},"id":86}
> { a: string, b: number }
> a: string, b: number
> a: string,
Expand All @@ -10,7 +10,7 @@ type Obj = { a: string, b: number }
> b --- {"kind":"primitive","primitive":"number","symbolMeta":{"name":"b","flags":4},"id":16}

type arrObj = Obj[]
> arrObj --- {"kind":"array","type":{"kind":"object","properties":[{"kind":"primitive","primitive":"string","symbolMeta":{"name":"a","flags":4},"id":15},{"kind":"primitive","primitive":"number","symbolMeta":{"name":"b","flags":4},"id":16}],"indexInfos":[],"symbolMeta":{"name":"__type","flags":2048,"anonymous":true},"aliasSymbolMeta":{"name":"Obj","flags":524288},"id":86},"symbolMeta":{"name":"arrObj","flags":524288},"aliasSymbolMeta":{"name":"arrObj","flags":524288},"id":87}
> arrObj --- {"kind":"array","type":{"kind":"object","properties":[{"kind":"primitive","primitive":"string","symbolMeta":{"name":"a","flags":4},"id":15},{"kind":"primitive","primitive":"number","symbolMeta":{"name":"b","flags":4},"id":16}],"indexInfos":[],"symbolMeta":{"name":"__type","flags":2048,"anonymous":true},"aliasSymbolMeta":{"name":"Obj","flags":524288},"id":86},"symbolMeta":{"name":"arrObj","flags":524288},"id":87}
> Obj[]
> Obj
> Obj --- {"kind":"object","properties":[{"kind":"primitive","primitive":"string","symbolMeta":{"name":"a","flags":4},"id":15},{"kind":"primitive","primitive":"number","symbolMeta":{"name":"b","flags":4},"id":16}],"indexInfos":[],"symbolMeta":{"name":"Obj","flags":524288},"aliasSymbolMeta":{"name":"Obj","flags":524288},"id":86}
> Obj --- {"kind":"object","properties":[{"kind":"primitive","primitive":"string","symbolMeta":{"name":"a","flags":4},"id":15},{"kind":"primitive","primitive":"number","symbolMeta":{"name":"b","flags":4},"id":16}],"indexInfos":[],"symbolMeta":{"name":"Obj","flags":524288},"id":86}
45 changes: 45 additions & 0 deletions tests/baselines/reference/class.merged.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
=== class.ts ===

interface TestInterface {
getThing(): string
}
> TestInterface --- { getThing: () => string; }
> getThing(): string
> getThing(): string
> getThing --- () => string

class TestClass implements TestInterface {
constructor(param: string) { }

getThing() {
return "as"
}
}
> class --- typeof TestClass
> TestClass --- typeof TestClass
> implements TestInterface
> implements TestInterface
> TestInterface
> TestInterface
> TestInterface --- { getThing: () => string; }
> constructor(param: string) { }
> getThing() {
> return "as"
> }
> constructor(param: string) { }
> constructor --- typeof TestClass
> param: string
> param: string
> param --- string
> getThing() {
> return "as"
> }
> getThing --- () => string

const _a = new TestClass("param")
> const _a = new TestClass("param")
> _a = new TestClass("param")
> _a = new TestClass("param")
> _a --- { getThing: () => string; }
> new TestClass("param")
> TestClass --- typeof TestClass
45 changes: 45 additions & 0 deletions tests/baselines/reference/class.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
=== class.ts ===

interface TestInterface {
getThing(): string
}
> TestInterface --- {"kind":"interface","properties":[{"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"primitive","primitive":"string","id":15}}],"symbolMeta":{"name":"getThing","flags":8192,"insideClassOrInterface":true},"id":87}],"implementsTypes":[],"constructSignatures":[],"symbolMeta":{"name":"TestInterface","flags":64},"id":86}
> getThing(): string
> getThing(): string
> getThing --- {"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"primitive","primitive":"string","id":15}}],"symbolMeta":{"name":"getThing","flags":8192,"insideClassOrInterface":true},"id":87}

class TestClass implements TestInterface {
constructor(param: string) { }

getThing() {
return "as"
}
}
> class --- {"kind":"class","properties":[{"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"primitive","primitive":"string","id":15}}],"symbolMeta":{"name":"getThing","flags":33562624,"insideClassOrInterface":true},"id":92}],"implementsTypes":[{"kind":"interface","properties":[{"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"reference","id":15}}],"symbolMeta":{"name":"getThing","flags":8192,"insideClassOrInterface":true},"id":87}],"implementsTypes":[],"constructSignatures":[],"symbolMeta":{"name":"TestInterface","flags":64},"id":86}],"constructSignatures":[{"parameters":[{"kind":"reference","symbolMeta":{"name":"param","flags":1},"id":15}]}],"classSymbol":{"name":"TestClass","flags":32},"symbolMeta":{"name":"TestClass","flags":32},"id":89}
> TestClass --- {"kind":"class","properties":[{"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"primitive","primitive":"string","id":15}}],"symbolMeta":{"name":"getThing","flags":33562624,"insideClassOrInterface":true},"id":92}],"implementsTypes":[{"kind":"interface","properties":[{"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"reference","id":15}}],"symbolMeta":{"name":"getThing","flags":8192,"insideClassOrInterface":true},"id":87}],"implementsTypes":[],"constructSignatures":[],"symbolMeta":{"name":"TestInterface","flags":64},"id":86}],"constructSignatures":[{"parameters":[{"kind":"reference","symbolMeta":{"name":"param","flags":1},"id":15}]}],"classSymbol":{"name":"TestClass","flags":32},"symbolMeta":{"name":"TestClass","flags":32},"id":89}
> implements TestInterface
> implements TestInterface
> TestInterface
> TestInterface
> TestInterface --- {"kind":"interface","properties":[{"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"primitive","primitive":"string","id":15}}],"symbolMeta":{"name":"getThing","flags":8192,"insideClassOrInterface":true},"id":87}],"implementsTypes":[],"constructSignatures":[],"symbolMeta":{"name":"TestInterface","flags":64},"id":86}
> constructor(param: string) { }
> getThing() {
> return "as"
> }
> constructor(param: string) { }
> constructor --- {"kind":"class","properties":[{"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"primitive","primitive":"string","id":15}}],"symbolMeta":{"name":"getThing","flags":33562624,"insideClassOrInterface":true},"id":92}],"implementsTypes":[{"kind":"interface","properties":[{"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"reference","id":15}}],"symbolMeta":{"name":"getThing","flags":8192,"insideClassOrInterface":true},"id":87}],"implementsTypes":[],"constructSignatures":[],"symbolMeta":{"name":"TestInterface","flags":64},"id":86}],"constructSignatures":[{"parameters":[{"kind":"reference","symbolMeta":{"name":"param","flags":1},"id":15}]}],"classSymbol":{"name":"TestClass","flags":32},"symbolMeta":{"name":"TestClass","flags":32},"id":89}
> param: string
> param: string
> param --- {"kind":"primitive","primitive":"string","symbolMeta":{"name":"param","flags":1},"id":15}
> getThing() {
> return "as"
> }
> getThing --- {"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"primitive","primitive":"string","id":15}}],"symbolMeta":{"name":"getThing","flags":8192,"insideClassOrInterface":true},"id":91}

const _a = new TestClass("param")
> const _a = new TestClass("param")
> _a = new TestClass("param")
> _a = new TestClass("param")
> _a --- {"kind":"class","properties":[{"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"primitive","primitive":"string","id":15}}],"symbolMeta":{"name":"getThing","flags":33562624,"insideClassOrInterface":true},"id":92}],"implementsTypes":[{"kind":"interface","properties":[{"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"reference","id":15}}],"symbolMeta":{"name":"getThing","flags":8192,"insideClassOrInterface":true},"id":87}],"implementsTypes":[],"constructSignatures":[],"symbolMeta":{"name":"TestInterface","flags":64},"id":86}],"constructSignatures":[{"parameters":[{"kind":"reference","symbolMeta":{"name":"param","flags":1},"id":15}]}],"classSymbol":{"name":"TestClass","flags":32},"symbolMeta":{"name":"_a","flags":2},"id":89}
> new TestClass("param")
> TestClass --- {"kind":"class","properties":[{"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"primitive","primitive":"string","id":15}}],"symbolMeta":{"name":"getThing","flags":33562624,"insideClassOrInterface":true},"id":92}],"implementsTypes":[{"kind":"interface","properties":[{"kind":"function","signatures":[{"parameters":[],"returnType":{"kind":"reference","id":15}}],"symbolMeta":{"name":"getThing","flags":8192,"insideClassOrInterface":true},"id":87}],"implementsTypes":[],"constructSignatures":[],"symbolMeta":{"name":"TestInterface","flags":64},"id":86}],"constructSignatures":[{"parameters":[{"kind":"reference","symbolMeta":{"name":"param","flags":1},"id":15}]}],"classSymbol":{"name":"TestClass","flags":32},"symbolMeta":{"name":"TestClass","flags":32},"id":89}
2 changes: 1 addition & 1 deletion tests/baselines/reference/conditional.tree
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== conditional.ts ===

type Conditional<T> = T extends string ? "a" : "b"
> Conditional --- {"kind":"conditional","checkType":{"kind":"type_parameter","symbolMeta":{"name":"T","flags":262144},"id":86},"extendsType":{"kind":"primitive","primitive":"string","id":15},"trueType":{"kind":"string_literal","value":"a","id":88},"falseType":{"kind":"string_literal","value":"b","id":90},"symbolMeta":{"name":"Conditional","flags":524288},"aliasSymbolMeta":{"name":"Conditional","flags":524288},"id":87}
> Conditional --- {"kind":"conditional","checkType":{"kind":"type_parameter","symbolMeta":{"name":"T","flags":262144},"id":86},"extendsType":{"kind":"primitive","primitive":"string","id":15},"trueType":{"kind":"string_literal","value":"a","id":88},"falseType":{"kind":"string_literal","value":"b","id":90},"symbolMeta":{"name":"Conditional","flags":524288},"id":87}
> T
> T
> T --- {"kind":"type_parameter","symbolMeta":{"name":"T","flags":262144},"id":86}
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/consoleLog.tree

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions tests/baselines/reference/enum.tree
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
=== enum.ts ===

enum Test { A, B, C }
> Test --- {"kind":"enum","properties":[{"kind":"enum_literal","value":0,"symbol":{"name":"A","flags":8},"parentSymbol":{"name":"Test","flags":256},"symbolMeta":{"name":"A","flags":8},"id":88},{"kind":"enum_literal","value":1,"symbol":{"name":"B","flags":8},"parentSymbol":{"name":"Test","flags":256},"symbolMeta":{"name":"B","flags":8},"id":90},{"kind":"enum_literal","value":2,"symbol":{"name":"C","flags":8},"parentSymbol":{"name":"Test","flags":256},"symbolMeta":{"name":"C","flags":8},"id":92}],"symbolMeta":{"name":"Test","flags":256},"id":86}
> Test --- {"kind":"enum","properties":[{"kind":"enum_literal","value":0,"literalSymbol":{"name":"A","flags":8},"parentSymbol":{"name":"Test","flags":256},"symbolMeta":{"name":"A","flags":8},"id":88},{"kind":"enum_literal","value":1,"literalSymbol":{"name":"B","flags":8},"parentSymbol":{"name":"Test","flags":256},"symbolMeta":{"name":"B","flags":8},"id":90},{"kind":"enum_literal","value":2,"literalSymbol":{"name":"C","flags":8},"parentSymbol":{"name":"Test","flags":256},"symbolMeta":{"name":"C","flags":8},"id":92}],"symbolMeta":{"name":"Test","flags":256},"id":86}
> A, B, C
> A
> A --- {"kind":"enum_literal","value":0,"symbol":{"name":"A","flags":8},"parentSymbol":{"name":"Test","flags":256},"symbolMeta":{"name":"A","flags":8},"id":88}
> A --- {"kind":"enum_literal","value":0,"literalSymbol":{"name":"A","flags":8},"parentSymbol":{"name":"Test","flags":256},"symbolMeta":{"name":"A","flags":8},"id":88}
> B
> B --- {"kind":"enum_literal","value":1,"symbol":{"name":"B","flags":8},"parentSymbol":{"name":"Test","flags":256},"symbolMeta":{"name":"B","flags":8},"id":90}
> B --- {"kind":"enum_literal","value":1,"literalSymbol":{"name":"B","flags":8},"parentSymbol":{"name":"Test","flags":256},"symbolMeta":{"name":"B","flags":8},"id":90}
> C
> C --- {"kind":"enum_literal","value":2,"symbol":{"name":"C","flags":8},"parentSymbol":{"name":"Test","flags":256},"symbolMeta":{"name":"C","flags":8},"id":92}
> C --- {"kind":"enum_literal","value":2,"literalSymbol":{"name":"C","flags":8},"parentSymbol":{"name":"Test","flags":256},"symbolMeta":{"name":"C","flags":8},"id":92}
2 changes: 1 addition & 1 deletion tests/baselines/reference/indexedAccess.tree
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== indexedAccess.ts ===

type IndexedAccess<P, T extends keyof P> = P[T]
> IndexedAccess --- {"kind":"indexed_access","indexType":{"kind":"type_parameter","baseConstraint":{"kind":"union","types":[{"kind":"primitive","primitive":"string","id":15},{"kind":"primitive","primitive":"number","id":16},{"kind":"primitive","primitive":"essymbol","id":23}],"id":31},"symbolMeta":{"name":"T","flags":262144},"id":87},"objectType":{"kind":"type_parameter","symbolMeta":{"name":"P","flags":262144},"id":86},"symbolMeta":{"name":"IndexedAccess","flags":524288},"aliasSymbolMeta":{"name":"IndexedAccess","flags":524288},"id":88}
> IndexedAccess --- {"kind":"indexed_access","indexType":{"kind":"type_parameter","baseConstraint":{"kind":"union","types":[{"kind":"primitive","primitive":"string","id":15},{"kind":"primitive","primitive":"number","id":16},{"kind":"primitive","primitive":"essymbol","id":23}],"id":31},"symbolMeta":{"name":"T","flags":262144},"id":87},"objectType":{"kind":"type_parameter","symbolMeta":{"name":"P","flags":262144},"id":86},"symbolMeta":{"name":"IndexedAccess","flags":524288},"id":88}
> P, T extends keyof P
> P
> P --- {"kind":"type_parameter","symbolMeta":{"name":"P","flags":262144},"id":86}
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/lambda.tree
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== lambda.ts ===

type f = (arg1: string, arg2: boolean) => void
> f --- {"kind":"function","signatures":[{"parameters":[{"kind":"primitive","primitive":"string","symbolMeta":{"name":"arg1","flags":1},"id":15},{"kind":"primitive","primitive":"boolean","symbolMeta":{"name":"arg2","flags":1},"id":22}],"returnType":{"kind":"primitive","primitive":"void","id":24}}],"symbolMeta":{"name":"f","flags":524288},"aliasSymbolMeta":{"name":"f","flags":524288},"id":86}
> f --- {"kind":"function","signatures":[{"parameters":[{"kind":"primitive","primitive":"string","symbolMeta":{"name":"arg1","flags":1},"id":15},{"kind":"primitive","primitive":"boolean","symbolMeta":{"name":"arg2","flags":1},"id":22}],"returnType":{"kind":"primitive","primitive":"void","id":24}}],"symbolMeta":{"name":"f","flags":524288},"id":86}
> (arg1: string, arg2: boolean) => void
> arg1: string, arg2: boolean
> arg1: string
Expand All @@ -11,12 +11,12 @@ type f = (arg1: string, arg2: boolean) => void
> => --- {"kind":"primitive","primitive":"any","symbolMeta":{"name":"__type","flags":2048},"id":4}

type t = { a: string } | f
> t --- {"kind":"union","types":[{"kind":"function","signatures":[{"parameters":[{"kind":"primitive","primitive":"string","symbolMeta":{"name":"arg1","flags":1},"id":15},{"kind":"primitive","primitive":"boolean","symbolMeta":{"name":"arg2","flags":1},"id":22}],"returnType":{"kind":"primitive","primitive":"void","id":24}}],"symbolMeta":{"name":"__type","flags":2048,"anonymous":true},"aliasSymbolMeta":{"name":"f","flags":524288},"id":86},{"kind":"object","properties":[{"kind":"reference","symbolMeta":{"name":"a","flags":4},"id":15}],"indexInfos":[],"symbolMeta":{"name":"__type","flags":2048,"anonymous":true},"id":87}],"symbolMeta":{"name":"t","flags":524288},"aliasSymbolMeta":{"name":"t","flags":524288},"id":88}
> t --- {"kind":"union","types":[{"kind":"function","signatures":[{"parameters":[{"kind":"primitive","primitive":"string","symbolMeta":{"name":"arg1","flags":1},"id":15},{"kind":"primitive","primitive":"boolean","symbolMeta":{"name":"arg2","flags":1},"id":22}],"returnType":{"kind":"primitive","primitive":"void","id":24}}],"symbolMeta":{"name":"__type","flags":2048,"anonymous":true},"aliasSymbolMeta":{"name":"f","flags":524288},"id":86},{"kind":"object","properties":[{"kind":"reference","symbolMeta":{"name":"a","flags":4},"id":15}],"indexInfos":[],"symbolMeta":{"name":"__type","flags":2048,"anonymous":true},"id":87}],"symbolMeta":{"name":"t","flags":524288},"id":88}
> { a: string } | f
> { a: string } | f
> { a: string }
> a: string
> a: string
> a --- {"kind":"primitive","primitive":"string","symbolMeta":{"name":"a","flags":4},"id":15}
> f
> f --- {"kind":"function","signatures":[{"parameters":[{"kind":"primitive","primitive":"string","symbolMeta":{"name":"arg1","flags":1},"id":15},{"kind":"primitive","primitive":"boolean","symbolMeta":{"name":"arg2","flags":1},"id":22}],"returnType":{"kind":"primitive","primitive":"void","id":24}}],"symbolMeta":{"name":"f","flags":524288},"aliasSymbolMeta":{"name":"f","flags":524288},"id":86}
> f --- {"kind":"function","signatures":[{"parameters":[{"kind":"primitive","primitive":"string","symbolMeta":{"name":"arg1","flags":1},"id":15},{"kind":"primitive","primitive":"boolean","symbolMeta":{"name":"arg2","flags":1},"id":22}],"returnType":{"kind":"primitive","primitive":"void","id":24}}],"symbolMeta":{"name":"f","flags":524288},"id":86}
2 changes: 1 addition & 1 deletion tests/baselines/reference/mapped.tree
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== mapped.ts ===

type mapped = { [index: string]: number }
> mapped --- {"kind":"object","properties":[],"indexInfos":[{"keyType":{"kind":"primitive","primitive":"string","id":15},"type":{"kind":"primitive","primitive":"number","id":16},"parameterSymbol":{"name":"index","flags":1}}],"symbolMeta":{"name":"mapped","flags":524288},"aliasSymbolMeta":{"name":"mapped","flags":524288},"id":86}
> mapped --- {"kind":"object","properties":[],"indexInfos":[{"keyType":{"kind":"primitive","primitive":"string","id":15},"type":{"kind":"primitive","primitive":"number","id":16},"parameterSymbol":{"name":"index","flags":1}}],"symbolMeta":{"name":"mapped","flags":524288},"id":86}
> { [index: string]: number }
> [index: string]: number
> [index: string]: number
Expand Down
Loading

0 comments on commit c50fe96

Please sign in to comment.