blob: 3fce8bf8ee3dd6fdc24aa40c40d81f23a04aa286 [file] [log] [blame]
/*
* Copyright (c) 2013, 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.
*/
/**
* @assertion Map<int, E> asMap()
* Returns an unmodifiable [Map] view of this.
* It has the indices of this list as keys, and the corresponding elements
* as values.
* @description Checks that the returned map is unmodifiable.
* @author msyabro
*/
import "dart:typed_data";
import "../../../Utils/expect.dart";
check(list) {
var l = new Int16List.fromList(list);
var m = l.asMap();
Expect.throws( () {
m[0] = 0;
});
}
main() {
check([]);
check([1]);
check([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
}