-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
100 additions
and
78 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
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 |
---|---|---|
@@ -1,52 +1,13 @@ | ||
import { UCMethodSymbol } from '../../Symbols'; | ||
import { DocumentAnalyzer } from '../../diagnostics/documentAnalyzer'; | ||
import { queueIndexDocument } from '../../indexer'; | ||
import { toName } from '../../name'; | ||
import { usingDocuments } from '../utils/utils'; | ||
import { assertDocumentAnalysis, assertDocumentDiagnoser } from '../utils/diagnosticUtils'; | ||
import { assertDocumentValidFieldsAnalysis, assertDocumentInvalidFieldsAnalysis } from '../utils/diagnosticUtils'; | ||
|
||
describe('Casting', () => { | ||
usingDocuments(__dirname, ['../interface/InterfaceTest.uc', 'CastingTest.uc'], ([, castingTestDocument]) => { | ||
queueIndexDocument(castingTestDocument); | ||
const castingTestClass = castingTestDocument.class; | ||
|
||
it('should have no problems', () => { | ||
assertDocumentAnalysis(castingTestDocument, /\bShould/).is.equal(0); | ||
}); | ||
|
||
//! Each statement is expected to report an invalid casting conversion. | ||
it('InvalidCastingTest should have problems', () => { | ||
const methodSymbol = castingTestClass.getSymbol<UCMethodSymbol>(toName('InvalidCastingTest')); | ||
|
||
const diagnoser = new DocumentAnalyzer(castingTestDocument); | ||
methodSymbol.accept(diagnoser); | ||
assertDocumentDiagnoser(diagnoser).is.equal(methodSymbol.block.statements.length); | ||
}); | ||
|
||
it('ValidCastingTest should have no problems', () => { | ||
const methodSymbol = castingTestClass.getSymbol<UCMethodSymbol>(toName('ValidCastingTest')); | ||
|
||
const diagnoser = new DocumentAnalyzer(castingTestDocument); | ||
methodSymbol.accept(diagnoser); | ||
assertDocumentDiagnoser(diagnoser).is.equal(0); | ||
}); | ||
|
||
//! Each statement is expected to report an invalid casting conversion. | ||
it('InvalidDynamicCastingInSwitchStatementTest should have problems', () => { | ||
const methodSymbol = castingTestClass.getSymbol<UCMethodSymbol>(toName('InvalidDynamicCastingInSwitchStatementTest')); | ||
|
||
const diagnoser = new DocumentAnalyzer(castingTestDocument); | ||
methodSymbol.accept(diagnoser); | ||
assertDocumentDiagnoser(diagnoser).is.equal(methodSymbol.block.statements.length); | ||
|
||
}); | ||
|
||
it('ValidTypesInSwitchStatementTest should have no problems', () => { | ||
const methodSymbol = castingTestClass.getSymbol<UCMethodSymbol>(toName('ValidTypesInSwitchStatementTest')); | ||
|
||
const diagnoser = new DocumentAnalyzer(castingTestDocument); | ||
methodSymbol.accept(diagnoser); | ||
assertDocumentDiagnoser(diagnoser).is.equal(0); | ||
it('should have no problems', () => { | ||
usingDocuments(__dirname, ['../interface/InterfaceTest.uc', 'CastingTest.uc', 'CastingDerivative.uc'], ([, castingTestDocument]) => { | ||
queueIndexDocument(castingTestDocument); | ||
assertDocumentValidFieldsAnalysis(castingTestDocument, /\bShould(?!BeInvalid)/i); | ||
assertDocumentInvalidFieldsAnalysis(castingTestDocument, /\bShouldBeInvalid/i); | ||
}); | ||
}); | ||
}); |
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
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { queueIndexDocument } from '../../indexer'; | ||
import { assertDocumentAnalysis } from '../utils/diagnosticUtils'; | ||
import { assertDocumentValidFieldsAnalysis } from '../utils/diagnosticUtils'; | ||
import { usingDocuments } from '../utils/utils'; | ||
|
||
describe('Struct usage', () => { | ||
usingDocuments(__dirname, ['StructTest.uc'], ([testDocument]) => { | ||
it('should have no problems', () => { | ||
it('should have no problems', () => { | ||
usingDocuments(__dirname, ['StructTest.uc'], ([testDocument]) => { | ||
queueIndexDocument(testDocument); | ||
assertDocumentAnalysis(testDocument).is.equal(0); | ||
assertDocumentValidFieldsAnalysis(testDocument); | ||
}); | ||
}); | ||
}); |
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