Skip to content

Commit

Permalink
test case for type checking of array index
Browse files Browse the repository at this point in the history
  • Loading branch information
bamboo committed May 4, 2012
1 parent a94a1f2 commit d202f57
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo
Expand Up @@ -82,6 +82,10 @@ partial class ErrorMessagesTestFixture:
RunTestCase("tests/error-messages/interface-errors.js")


[Test] def invalid_array_index():
RunTestCase("tests/error-messages/invalid-array-index.js")


[Test] def invalid_attribute_sequence():
RunTestCase("tests/error-messages/invalid-attribute-sequence.js")

Expand Down
13 changes: 13 additions & 0 deletions tests/error-messages/invalid-array-index.js
@@ -0,0 +1,13 @@
/*
invalid-array-index.js(11,25): BCE0022: Cannot convert 'UnityScript.Tests.CSharp.Vector3' to 'int'.
*/
import UnityScript.Tests.CSharp;

var tiles : int[,];
var v2 = Vector3(1, 1, 1);

function Start () {
tiles = new int[5, 5];
print (tiles[0, v2]);
}

0 comments on commit d202f57

Please sign in to comment.