Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
permit valid destructure
Browse files Browse the repository at this point in the history
  • Loading branch information
jvasileff committed Jul 9, 2016
1 parent 598fab2 commit a90cbae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions language/test/tuples.ceylon
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,19 @@ shared void tuples() {
try {
value a = [finished, finished, finished];
value [b, *c] = a;
fail("Spread of tuple with initial 'finished' should have thrown");
if (c.size != 2 || b != finished || c != [finished, finished]) {
fail("Spread of tuple with initial 'finished' should have thrown");
}
} catch (AssertionError e) {
check(e.message == "length of c is less than minimum length of its static type Finished[2]", "deconstruct [finished] 1");
}

try {
value a = [finished, 1, finished];
value [b, *c] = a;
fail("Deconstruct of tuple with initial 'finished' should have thrown");
print(c[1].string);
if (c.size != 2 || b != finished || c != [1, finished]) {
fail("Deconstruct of tuple with initial 'finished' should have thrown");
}
} catch (AssertionError e) {
check(e.message == "length of c is less than minimum length of its static type [Integer, Finished]", "deconstruct [finished] 2");
}
Expand Down

0 comments on commit a90cbae

Please sign in to comment.