OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 OS::SNPrint(buffer, sizeof(buffer), | 1957 OS::SNPrint(buffer, sizeof(buffer), |
1958 "main() {\n" | 1958 "main() {\n" |
1959 " new List(%" Pd ");\n" | 1959 " new List(%" Pd ");\n" |
1960 "}\n", | 1960 "}\n", |
1961 length); | 1961 length); |
1962 Dart_Handle lib = TestCase::LoadTestScript(buffer, NULL); | 1962 Dart_Handle lib = TestCase::LoadTestScript(buffer, NULL); |
1963 EXPECT_VALID(lib); | 1963 EXPECT_VALID(lib); |
1964 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 1964 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
1965 OS::SNPrint(buffer, sizeof(buffer), | 1965 OS::SNPrint(buffer, sizeof(buffer), |
1966 "Unhandled exception:\n" | 1966 "Unhandled exception:\n" |
1967 "Invalid argument(s): Length (%" Pd ") must be an integer " | 1967 "RangeError (length): Invalid value: " |
1968 "in the range [0..%" Pd "].", | 1968 "Not in range 0..%" Pd ", inclusive: %" Pd, |
1969 length, Array::kMaxElements); | 1969 Array::kMaxElements, length); |
1970 EXPECT_ERROR(result, buffer); | 1970 EXPECT_ERROR(result, buffer); |
1971 } | 1971 } |
1972 | 1972 |
1973 | 1973 |
1974 TEST_CASE(ArrayLengthNegativeOne) { TestIllegalArrayLength(-1); } | 1974 TEST_CASE(ArrayLengthNegativeOne) { TestIllegalArrayLength(-1); } |
1975 TEST_CASE(ArrayLengthSmiMin) { TestIllegalArrayLength(kSmiMin); } | 1975 TEST_CASE(ArrayLengthSmiMin) { TestIllegalArrayLength(kSmiMin); } |
1976 TEST_CASE(ArrayLengthOneTooMany) { | 1976 TEST_CASE(ArrayLengthOneTooMany) { |
1977 const intptr_t kOneTooMany = Array::kMaxElements + 1; | 1977 const intptr_t kOneTooMany = Array::kMaxElements + 1; |
1978 ASSERT(kOneTooMany >= 0); | 1978 ASSERT(kOneTooMany >= 0); |
1979 TestIllegalArrayLength(kOneTooMany); | 1979 TestIllegalArrayLength(kOneTooMany); |
(...skipping 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4703 EXPECT(iterator.MoveNext()); | 4703 EXPECT(iterator.MoveNext()); |
4704 object = iterator.CurrentKey(); | 4704 object = iterator.CurrentKey(); |
4705 EXPECT_STREQ("z", object.ToCString()); | 4705 EXPECT_STREQ("z", object.ToCString()); |
4706 object = iterator.CurrentValue(); | 4706 object = iterator.CurrentValue(); |
4707 EXPECT_STREQ("5", object.ToCString()); | 4707 EXPECT_STREQ("5", object.ToCString()); |
4708 | 4708 |
4709 EXPECT(!iterator.MoveNext()); | 4709 EXPECT(!iterator.MoveNext()); |
4710 } | 4710 } |
4711 | 4711 |
4712 } // namespace dart | 4712 } // namespace dart |
OLD | NEW |