Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1088)

Side by Side Diff: runtime/vm/object_test.cc

Issue 1214723009: Make List constructor give better error messages for non-int arguments (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Use unused variable. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/exceptions.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « runtime/vm/exceptions.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698