edcae54a2c
Review URL: https://chromereviews.googleplex.com/3574018 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@394 260f80e4-7a28-3924-810f-c04153c831b5
28 lines
988 B
Dart
28 lines
988 B
Dart
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
main() {
|
|
testImmutable(const []);
|
|
testImmutable(const [1]);
|
|
testImmutable(const [1, 2]);
|
|
}
|
|
|
|
void expectUOE(Function f) {
|
|
Expect.throws(f, (e) => e is UnsupportedOperationException);
|
|
}
|
|
|
|
testImmutable(var list) {
|
|
expectUOE(() { list.setRange(0, 0, const []); });
|
|
expectUOE(() { list.setRange(0, 1, const [], 1); });
|
|
expectUOE(() { list.setRange(0, 1, const []); });
|
|
expectUOE(() { list.setRange(0, 0, []); });
|
|
expectUOE(() { list.setRange(0, 1, [], 1); });
|
|
expectUOE(() { list.setRange(0, 1, []); });
|
|
expectUOE(() { list.setRange(0, 0, const [1]); });
|
|
expectUOE(() { list.setRange(0, 1, const [1]); });
|
|
expectUOE(() { list.setRange(0, 0, [1]); });
|
|
expectUOE(() { list.setRange(0, 1, [1]); });
|
|
expectUOE(() { list.setRange(0, 1, [1], 1); });
|
|
}
|