22///<reference path='harness.ts'/>
33///<reference path='runnerbase.ts' />
44
5- const enum FourSlashTestType {
5+ const enum FourSlashTestType {
66 Native ,
77 Shims ,
88 Server
@@ -35,70 +35,72 @@ class FourSlashRunner extends RunnerBase {
3535 this . tests = this . enumerateFiles ( this . basePath , / \. t s / i, { recursive : false } ) ;
3636 }
3737
38+ describe ( 'Fourslash tests' , ( ) => {
3839 this . tests . forEach ( ( fn : string ) => {
39- describe ( fn , ( ) => {
40- fn = ts . normalizeSlashes ( fn ) ;
41- var justName = fn . replace ( / ^ .* [ \\ \/ ] / , '' ) ;
40+ describe ( fn , ( ) => {
41+ fn = ts . normalizeSlashes ( fn ) ;
42+ var justName = fn . replace ( / ^ .* [ \\ \/ ] / , '' ) ;
4243
43- // Convert to relative path
44- var testIndex = fn . indexOf ( 'tests/' ) ;
45- if ( testIndex >= 0 ) fn = fn . substr ( testIndex ) ;
44+ // Convert to relative path
45+ var testIndex = fn . indexOf ( 'tests/' ) ;
46+ if ( testIndex >= 0 ) fn = fn . substr ( testIndex ) ;
4647
47- if ( justName && ! justName . match ( / f o u r s l a s h \. t s $ / i) && ! justName . match ( / \. d \. t s $ / i) ) {
48- it ( this . testSuiteName + ' test ' + justName + ' runs correctly' , ( ) => {
49- FourSlash . runFourSlashTest ( this . basePath , this . testType , fn ) ;
50- } ) ;
51- }
48+ if ( justName && ! justName . match ( / f o u r s l a s h \. t s $ / i) && ! justName . match ( / \. d \. t s $ / i) ) {
49+ it ( this . testSuiteName + ' test ' + justName + ' runs correctly' , ( ) => {
50+ FourSlash . runFourSlashTest ( this . basePath , this . testType , fn ) ;
51+ } ) ;
52+ }
53+ } ) ;
5254 } ) ;
53- } ) ;
5455
55- describe ( 'Generate Tao XML' , ( ) => {
56- var invalidReasons : any = { } ;
57- FourSlash . xmlData . forEach ( xml => {
58- if ( xml . invalidReason !== null ) {
59- invalidReasons [ xml . invalidReason ] = ( invalidReasons [ xml . invalidReason ] || 0 ) + 1 ;
60- }
61- } ) ;
62- var invalidReport : { reason : string ; count : number } [ ] = [ ] ;
63- for ( var reason in invalidReasons ) {
64- if ( invalidReasons . hasOwnProperty ( reason ) ) {
65- invalidReport . push ( { reason : reason , count : invalidReasons [ reason ] } ) ;
56+ describe ( 'Generate Tao XML' , ( ) => {
57+ var invalidReasons : any = { } ;
58+ FourSlash . xmlData . forEach ( xml => {
59+ if ( xml . invalidReason !== null ) {
60+ invalidReasons [ xml . invalidReason ] = ( invalidReasons [ xml . invalidReason ] || 0 ) + 1 ;
61+ }
62+ } ) ;
63+ var invalidReport : { reason : string ; count : number } [ ] = [ ] ;
64+ for ( var reason in invalidReasons ) {
65+ if ( invalidReasons . hasOwnProperty ( reason ) ) {
66+ invalidReport . push ( { reason : reason , count : invalidReasons [ reason ] } ) ;
67+ }
6668 }
67- }
68- invalidReport . sort ( ( lhs , rhs ) => lhs . count > rhs . count ? - 1 : lhs . count === rhs . count ? 0 : 1 ) ;
69+ invalidReport . sort ( ( lhs , rhs ) => lhs . count > rhs . count ? - 1 : lhs . count === rhs . count ? 0 : 1 ) ;
6970
70- var lines : string [ ] = [ ] ;
71- lines . push ( '<!-- Blocked Test Report' ) ;
72- invalidReport . forEach ( ( reasonAndCount ) => {
73- lines . push ( reasonAndCount . count + ' tests blocked by ' + reasonAndCount . reason ) ;
71+ var lines : string [ ] = [ ] ;
72+ lines . push ( '<!-- Blocked Test Report' ) ;
73+ invalidReport . forEach ( ( reasonAndCount ) => {
74+ lines . push ( reasonAndCount . count + ' tests blocked by ' + reasonAndCount . reason ) ;
75+ } ) ;
76+ lines . push ( '-->' ) ;
77+ lines . push ( '<TaoTest xmlns="http://microsoft.com/schemas/VSLanguages/TAO">' ) ;
78+ lines . push ( ' <InitTest>' ) ;
79+ lines . push ( ' <StartTarget />' ) ;
80+ lines . push ( ' </InitTest>' ) ;
81+ lines . push ( ' <ScenarioList>' ) ;
82+ FourSlash . xmlData . forEach ( xml => {
83+ if ( xml . invalidReason !== null ) {
84+ lines . push ( '<!-- Skipped ' + xml . originalName + ', reason: ' + xml . invalidReason + ' -->' ) ;
85+ } else {
86+ lines . push ( ' <Scenario Name="' + xml . originalName + '">' ) ;
87+ xml . actions . forEach ( action => {
88+ lines . push ( ' ' + action ) ;
89+ } ) ;
90+ lines . push ( ' </Scenario>' ) ;
91+ }
92+ } ) ;
93+ lines . push ( ' </ScenarioList>' ) ;
94+ lines . push ( ' <CleanupScenario>' ) ;
95+ lines . push ( ' <CloseAllDocuments />' ) ;
96+ lines . push ( ' <CleanupCreatedFiles />' ) ;
97+ lines . push ( ' </CleanupScenario>' ) ;
98+ lines . push ( ' <CleanupTest>' ) ;
99+ lines . push ( ' <CloseTarget />' ) ;
100+ lines . push ( ' </CleanupTest>' ) ;
101+ lines . push ( '</TaoTest>' ) ;
102+ Harness . IO . writeFile ( 'built/local/fourslash.xml' , lines . join ( '\r\n' ) ) ;
74103 } ) ;
75- lines . push ( '-->' ) ;
76- lines . push ( '<TaoTest xmlns="http://microsoft.com/schemas/VSLanguages/TAO">' ) ;
77- lines . push ( ' <InitTest>' ) ;
78- lines . push ( ' <StartTarget />' ) ;
79- lines . push ( ' </InitTest>' ) ;
80- lines . push ( ' <ScenarioList>' ) ;
81- FourSlash . xmlData . forEach ( xml => {
82- if ( xml . invalidReason !== null ) {
83- lines . push ( '<!-- Skipped ' + xml . originalName + ', reason: ' + xml . invalidReason + ' -->' ) ;
84- } else {
85- lines . push ( ' <Scenario Name="' + xml . originalName + '">' ) ;
86- xml . actions . forEach ( action => {
87- lines . push ( ' ' + action ) ;
88- } ) ;
89- lines . push ( ' </Scenario>' ) ;
90- }
91- } ) ;
92- lines . push ( ' </ScenarioList>' ) ;
93- lines . push ( ' <CleanupScenario>' ) ;
94- lines . push ( ' <CloseAllDocuments />' ) ;
95- lines . push ( ' <CleanupCreatedFiles />' ) ;
96- lines . push ( ' </CleanupScenario>' ) ;
97- lines . push ( ' <CleanupTest>' ) ;
98- lines . push ( ' <CloseTarget />' ) ;
99- lines . push ( ' </CleanupTest>' ) ;
100- lines . push ( '</TaoTest>' ) ;
101- Harness . IO . writeFile ( 'built/local/fourslash.xml' , lines . join ( '\r\n' ) ) ;
102104 } ) ;
103105 }
104106}
@@ -108,4 +110,4 @@ class GeneratedFourslashRunner extends FourSlashRunner {
108110 super ( testType ) ;
109111 this . basePath += '/generated/' ;
110112 }
111- }
113+ }
0 commit comments