Index: runtime/vm/dart_api_impl_test.cc |
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc |
index 46653c859cd37d225bd3bd55b8894823b0ef4f89..1ddb87f708e6daba0fdfa127f5f0a8df7cbb1b77 100644 |
--- a/runtime/vm/dart_api_impl_test.cc |
+++ b/runtime/vm/dart_api_impl_test.cc |
@@ -1368,6 +1368,24 @@ TEST_CASE(ListAccess) { |
result = Dart_ListGetAt(list_access_test_obj, 4); |
EXPECT(Dart_IsError(result)); |
+ // Check if we can get a range of values. |
+ result = Dart_ListGetRange(list_access_test_obj, 8, 4, nullptr); |
+ EXPECT(Dart_IsError(result)); |
+ |
+ const int kRangeOffset = 1; |
+ const int kRangeLength = 3 - kRangeOffset; |
+ Dart_Handle values[kRangeLength]; |
+ result = Dart_ListGetRange(val, kOffset, kRangeLength, values); |
+ EXPECT_VALID(result); |
+ |
+ result = Dart_IntegerToInt64(values[0], &value); |
+ EXPECT_VALID(result); |
+ EXPECT_EQ(20, value); |
+ |
+ result = Dart_IntegerToInt64(values[1], &value); |
+ EXPECT_VALID(result); |
+ EXPECT_EQ(30, value); |
+ |
// Check that we get an exception (and not a fatal error) when |
// calling ListSetAt and ListSetAsBytes with an immutable list. |
list_access_test_obj = Dart_Invoke(lib, NewString("immutable"), 0, NULL); |