-
-
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
3 changed files
with
58 additions
and
1 deletion.
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,40 @@ | ||
class ArrayTest; | ||
|
||
var array<string> array; | ||
|
||
function ShouldBeValidArrayIteratorTest() | ||
{ | ||
local string s; | ||
local int i; | ||
|
||
// ! UC3 "Type 'Array' cannot be iterated. Expected an iterator function." | ||
foreach array(s, i); | ||
|
||
array[0] = ""; | ||
array[0.0] = ""; | ||
} | ||
|
||
function ShouldBeInvalidArrayIteratorTest() | ||
{ | ||
local string s; | ||
local int i; | ||
|
||
// #if UC2 | ||
// // ! UC2 "Type 'Array' cannot be iterated. Expected an iterator function." | ||
// foreach array(s, i); | ||
// #endif | ||
|
||
// ! Expected "Missing iterator arguments." | ||
foreach array(); | ||
|
||
// Wrong order | ||
foreach array(i, s); | ||
|
||
// ! "An element access expression should take an argument." | ||
array[]; | ||
|
||
// ! "Type of 'None.ArrayTest.ShouldBeInvalidArrayIteratorTest.B' is not a valid array." | ||
b[0]; | ||
|
||
b[""]; | ||
} |
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,15 @@ | ||
import { queueIndexDocument } from '../../indexer'; | ||
import { assertDocumentInvalidFieldsAnalysis, assertDocumentValidFieldsAnalysis } from '../utils/diagnosticUtils'; | ||
import { usingDocuments } from '../utils/utils'; | ||
|
||
describe('Array usage', () => { | ||
usingDocuments(__dirname, ['ArrayTest.uc'], ([testDocument]) => { | ||
queueIndexDocument(testDocument); | ||
|
||
it('should have no problems', () => { | ||
queueIndexDocument(testDocument); | ||
assertDocumentValidFieldsAnalysis(testDocument, /\bShould(?!BeInvalid)/i); | ||
assertDocumentInvalidFieldsAnalysis(testDocument, /\bInvalid/); | ||
}); | ||
}); | ||
}); |
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