Index: runtime/vm/object_test.cc |
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc |
index 3a78c140ee201a9fb247c66b43b3070f6da08453..e8e04b106c3b4543f4f3dd235aaf0d5fa1142a67 100644 |
--- a/runtime/vm/object_test.cc |
+++ b/runtime/vm/object_test.cc |
@@ -6,6 +6,7 @@ |
#include "vm/assembler.h" |
#include "vm/class_finalizer.h" |
+#include "vm/code_descriptors.h" |
#include "vm/dart_api_impl.h" |
#include "vm/dart_entry.h" |
#include "vm/debugger.h" |
@@ -16,13 +17,11 @@ |
#include "vm/simulator.h" |
#include "vm/symbols.h" |
#include "vm/unit_test.h" |
-#include "vm/code_descriptors.h" |
namespace dart { |
DECLARE_FLAG(bool, write_protect_code); |
- |
static RawClass* CreateDummyClass(const String& class_name, |
const Script& script) { |
const Class& cls = Class::Handle(Class::New( |
@@ -31,7 +30,6 @@ static RawClass* CreateDummyClass(const String& class_name, |
return cls.raw(); |
} |
- |
ISOLATE_UNIT_TEST_CASE(Class) { |
// Allocate the class first. |
const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); |
@@ -139,7 +137,6 @@ ISOLATE_UNIT_TEST_CASE(Class) { |
EXPECT_EQ(kNumOptionalParameters, function.NumOptionalParameters()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(TypeArguments) { |
const Type& type1 = Type::Handle(Type::Double()); |
const Type& type2 = Type::Handle(Type::StringType()); |
@@ -161,7 +158,6 @@ ISOLATE_UNIT_TEST_CASE(TypeArguments) { |
EXPECT_EQ(type_arguments1.raw(), type_arguments3.raw()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(TokenStream) { |
Zone* zone = Thread::Current()->zone(); |
String& source = String::Handle(zone, String::New("= ( 9 , .")); |
@@ -179,7 +175,6 @@ ISOLATE_UNIT_TEST_CASE(TokenStream) { |
EXPECT_EQ(Token::kEOS, iterator.CurrentTokenKind()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(GenerateExactSource) { |
// Verify the exact formatting of generated sources. |
const char* kScriptChars = |
@@ -218,7 +213,6 @@ ISOLATE_UNIT_TEST_CASE(GenerateExactSource) { |
EXPECT_STREQ(source.ToCString(), gen_source.ToCString()); |
} |
- |
TEST_CASE(Class_ComputeEndTokenPos) { |
const char* kScript = |
"\n" |
@@ -247,7 +241,6 @@ TEST_CASE(Class_ComputeEndTokenPos) { |
EXPECT(line == 10 && col == 1); |
} |
- |
ISOLATE_UNIT_TEST_CASE(InstanceClass) { |
// Allocate the class first. |
String& class_name = String::Handle(Symbols::New(thread, "EmptyClass")); |
@@ -293,7 +286,6 @@ ISOLATE_UNIT_TEST_CASE(InstanceClass) { |
EXPECT(one_field_class.is_implemented()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(Smi) { |
const Smi& smi = Smi::Handle(Smi::New(5)); |
Object& smi_object = Object::Handle(smi.raw()); |
@@ -354,7 +346,6 @@ ISOLATE_UNIT_TEST_CASE(Smi) { |
EXPECT_EQ(1, c.CompareWith(big2)); |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringCompareTo) { |
const String& abcd = String::Handle(String::New("abcd")); |
const String& abce = String::Handle(String::New("abce")); |
@@ -397,7 +388,6 @@ ISOLATE_UNIT_TEST_CASE(StringCompareTo) { |
EXPECT(monkey_face.CompareTo(abce) > 0); |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringEncodeIRI) { |
const char* kInput = |
"file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart"; |
@@ -409,7 +399,6 @@ ISOLATE_UNIT_TEST_CASE(StringEncodeIRI) { |
EXPECT(strcmp(encoded, kOutput) == 0); |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringDecodeIRI) { |
const char* kOutput = |
"file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart"; |
@@ -422,7 +411,6 @@ ISOLATE_UNIT_TEST_CASE(StringDecodeIRI) { |
EXPECT(output.Equals(decoded)); |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringDecodeIRIInvalid) { |
String& input = String::Handle(); |
input = String::New("file%"); |
@@ -437,7 +425,6 @@ ISOLATE_UNIT_TEST_CASE(StringDecodeIRIInvalid) { |
EXPECT(decoded.IsNull()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringIRITwoByte) { |
const intptr_t kInputLen = 3; |
const uint16_t kInput[kInputLen] = {'x', '/', 256}; |
@@ -452,7 +439,6 @@ ISOLATE_UNIT_TEST_CASE(StringIRITwoByte) { |
EXPECT(input.Equals(decoded)); |
} |
- |
ISOLATE_UNIT_TEST_CASE(Mint) { |
// On 64-bit architectures a Smi is stored in a 64 bit word. A Midint cannot |
// be allocated if it does fit into a Smi. |
@@ -526,7 +512,6 @@ ISOLATE_UNIT_TEST_CASE(Mint) { |
#endif |
} |
- |
ISOLATE_UNIT_TEST_CASE(Double) { |
{ |
const double dbl_const = 5.0; |
@@ -610,7 +595,6 @@ ISOLATE_UNIT_TEST_CASE(Double) { |
} |
} |
- |
ISOLATE_UNIT_TEST_CASE(Bigint) { |
Bigint& b = Bigint::Handle(); |
EXPECT(b.IsNull()); |
@@ -649,7 +633,6 @@ ISOLATE_UNIT_TEST_CASE(Bigint) { |
EXPECT_EQ(1, smi2.CompareWith(big3)); |
} |
- |
ISOLATE_UNIT_TEST_CASE(Integer) { |
Integer& i = Integer::Handle(); |
i = Integer::NewCanonical(String::Handle(String::New("12"))); |
@@ -666,7 +649,6 @@ ISOLATE_UNIT_TEST_CASE(Integer) { |
EXPECT(i.IsBigint()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(String) { |
const char* kHello = "Hello World!"; |
int32_t hello_len = strlen(kHello); |
@@ -813,7 +795,6 @@ ISOLATE_UNIT_TEST_CASE(String) { |
} |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringFormat) { |
const char* hello_str = "Hello World!"; |
const String& str = |
@@ -826,7 +807,6 @@ ISOLATE_UNIT_TEST_CASE(StringFormat) { |
EXPECT(str.Equals(hello_str)); |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringConcat) { |
// Create strings from concatenated 1-byte empty strings. |
{ |
@@ -1357,7 +1337,6 @@ ISOLATE_UNIT_TEST_CASE(StringConcat) { |
} |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringHashConcat) { |
EXPECT_EQ(String::Handle(String::New("onebyte")).Hash(), |
String::HashConcat(String::Handle(String::New("one")), |
@@ -1373,7 +1352,6 @@ ISOLATE_UNIT_TEST_CASE(StringHashConcat) { |
String::Handle(String::FromUTF16(clef_utf16 + 1, 1)))); |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringSubStringDifferentWidth) { |
// Create 1-byte substring from a 1-byte source string. |
const char* onechars = "\xC3\xB6\xC3\xB1\xC3\xA9"; |
@@ -1434,7 +1412,6 @@ ISOLATE_UNIT_TEST_CASE(StringSubStringDifferentWidth) { |
EXPECT(foursub4.IsTwoByteString()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringFromUtf8Literal) { |
// Create a 1-byte string from a UTF-8 encoded string literal. |
{ |
@@ -1594,7 +1571,6 @@ ISOLATE_UNIT_TEST_CASE(StringFromUtf8Literal) { |
} |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringEqualsUtf8) { |
const char* onesrc = "abc"; |
const String& onestr = String::Handle(String::New(onesrc)); |
@@ -1626,7 +1602,6 @@ ISOLATE_UNIT_TEST_CASE(StringEqualsUtf8) { |
"\xF0\x90\x8E\xA2\xF0\x90\x8E\xA3")); |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringEqualsUTF32) { |
const String& empty = String::Handle(String::New("")); |
const String& t_str = String::Handle(String::New("t")); |
@@ -1643,7 +1618,6 @@ ISOLATE_UNIT_TEST_CASE(StringEqualsUTF32) { |
EXPECT(!th_str.Equals(chars, 3)); |
} |
- |
ISOLATE_UNIT_TEST_CASE(ExternalOneByteString) { |
uint8_t characters[] = {0xF6, 0xF1, 0xE9}; |
intptr_t len = ARRAY_SIZE(characters); |
@@ -1674,7 +1648,6 @@ ISOLATE_UNIT_TEST_CASE(ExternalOneByteString) { |
EXPECT(substr.Equals("\xC3\xB1")); |
} |
- |
ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersOneByteString) { |
uint8_t characters[] = {'a', '\n', '\f', '\b', '\t', |
'\v', '\r', '\\', '$', 'z'}; |
@@ -1694,7 +1667,6 @@ ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersOneByteString) { |
EXPECT_EQ(escaped_empty_str.Length(), 0); |
} |
- |
ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersExternalOneByteString) { |
uint8_t characters[] = {'a', '\n', '\f', '\b', '\t', |
'\v', '\r', '\\', '$', 'z'}; |
@@ -1740,7 +1712,6 @@ ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersTwoByteString) { |
EXPECT_EQ(escaped_empty_str.Length(), 0); |
} |
- |
ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersExternalTwoByteString) { |
uint16_t characters[] = {'a', '\n', '\f', '\b', '\t', |
'\v', '\r', '\\', '$', 'z'}; |
@@ -1763,7 +1734,6 @@ ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersExternalTwoByteString) { |
EXPECT_EQ(escaped_empty_str.Length(), 0); |
} |
- |
ISOLATE_UNIT_TEST_CASE(ExternalTwoByteString) { |
uint16_t characters[] = {0x1E6B, 0x1E85, 0x1E53}; |
intptr_t len = ARRAY_SIZE(characters); |
@@ -1796,7 +1766,6 @@ ISOLATE_UNIT_TEST_CASE(ExternalTwoByteString) { |
EXPECT(substr.Equals("\xE1\xBA\x85")); |
} |
- |
ISOLATE_UNIT_TEST_CASE(Symbol) { |
const String& one = String::Handle(Symbols::New(thread, "Eins")); |
EXPECT(one.IsSymbol()); |
@@ -1858,7 +1827,6 @@ ISOLATE_UNIT_TEST_CASE(Symbol) { |
EXPECT_EQ(elf2.raw(), Symbols::New(thread, "Elf")); |
} |
- |
ISOLATE_UNIT_TEST_CASE(SymbolUnicode) { |
uint16_t monkey_utf16[] = {0xd83d, 0xdc35}; // Unicode Monkey Face. |
String& monkey = String::Handle(Symbols::FromUTF16(thread, monkey_utf16, 2)); |
@@ -1881,13 +1849,11 @@ ISOLATE_UNIT_TEST_CASE(SymbolUnicode) { |
EXPECT_EQ(cat2.raw(), cat.raw()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(Bool) { |
EXPECT(Bool::True().value()); |
EXPECT(!Bool::False().value()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(Array) { |
const int kArrayLen = 5; |
const Array& array = Array::Handle(Array::New(kArrayLen)); |
@@ -1931,7 +1897,6 @@ ISOLATE_UNIT_TEST_CASE(Array) { |
EXPECT(obj.IsArray()); |
} |
- |
static void TestIllegalArrayLength(intptr_t length) { |
char buffer[1024]; |
OS::SNPrint(buffer, sizeof(buffer), |
@@ -1951,7 +1916,6 @@ static void TestIllegalArrayLength(intptr_t length) { |
EXPECT_ERROR(result, buffer); |
} |
- |
TEST_CASE(ArrayLengthNegativeOne) { |
TestIllegalArrayLength(-1); |
} |
@@ -1964,7 +1928,6 @@ TEST_CASE(ArrayLengthOneTooMany) { |
TestIllegalArrayLength(kOneTooMany); |
} |
- |
TEST_CASE(ArrayLengthMaxElements) { |
char buffer[1024]; |
OS::SNPrint(buffer, sizeof(buffer), |
@@ -1986,7 +1949,6 @@ TEST_CASE(ArrayLengthMaxElements) { |
} |
} |
- |
static void TestIllegalTypedDataLength(const char* class_name, |
intptr_t length) { |
char buffer[1024]; |
@@ -2005,7 +1967,6 @@ static void TestIllegalTypedDataLength(const char* class_name, |
EXPECT_ERROR(result, buffer); |
} |
- |
TEST_CASE(Int8ListLengthNegativeOne) { |
TestIllegalTypedDataLength("Int8List", -1); |
} |
@@ -2019,7 +1980,6 @@ TEST_CASE(Int8ListLengthOneTooMany) { |
TestIllegalTypedDataLength("Int8List", kOneTooMany); |
} |
- |
TEST_CASE(Int8ListLengthMaxElements) { |
const intptr_t max_elements = TypedData::MaxElements(kTypedDataInt8ArrayCid); |
char buffer[1024]; |
@@ -2042,7 +2002,6 @@ TEST_CASE(Int8ListLengthMaxElements) { |
} |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringCodePointIterator) { |
const String& str0 = String::Handle(String::New("")); |
String::CodePointIterator it0(str0); |
@@ -2099,7 +2058,6 @@ ISOLATE_UNIT_TEST_CASE(StringCodePointIterator) { |
EXPECT(!it3.Next()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(StringCodePointIteratorRange) { |
const String& str = String::Handle(String::New("foo bar baz")); |
@@ -2116,7 +2074,6 @@ ISOLATE_UNIT_TEST_CASE(StringCodePointIteratorRange) { |
EXPECT(!it1.Next()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(GrowableObjectArray) { |
const int kArrayLen = 5; |
Smi& value = Smi::Handle(); |
@@ -2238,7 +2195,6 @@ ISOLATE_UNIT_TEST_CASE(GrowableObjectArray) { |
EXPECT_EQ(1, new_array.Length()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(InternalTypedData) { |
uint8_t data[] = {253, 254, 255, 0, 1, 2, 3, 4}; |
intptr_t data_length = ARRAY_SIZE(data); |
@@ -2294,7 +2250,6 @@ ISOLATE_UNIT_TEST_CASE(InternalTypedData) { |
} |
} |
- |
ISOLATE_UNIT_TEST_CASE(ExternalTypedData) { |
uint8_t data[] = {253, 254, 255, 0, 1, 2, 3, 4}; |
intptr_t data_length = ARRAY_SIZE(data); |
@@ -2357,7 +2312,6 @@ ISOLATE_UNIT_TEST_CASE(ExternalTypedData) { |
} |
} |
- |
TEST_CASE(Script) { |
const char* url_chars = "builtin:test-case"; |
const char* source_chars = "This will not compile."; |
@@ -2388,7 +2342,6 @@ TEST_CASE(Script) { |
EXPECT_VALID(result); |
} |
- |
ISOLATE_UNIT_TEST_CASE(EmbeddedScript) { |
const char* url_chars = "builtin:test-case"; |
const char* text = |
@@ -2490,7 +2443,6 @@ ISOLATE_UNIT_TEST_CASE(EmbeddedScript) { |
free(src_chars); |
} |
- |
ISOLATE_UNIT_TEST_CASE(Context) { |
const int kNumVariables = 5; |
const Context& parent_context = Context::Handle(Context::New(0)); |
@@ -2513,7 +2465,6 @@ ISOLATE_UNIT_TEST_CASE(Context) { |
EXPECT_EQ(3, smi.Value()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(ContextScope) { |
const intptr_t parent_scope_function_level = 0; |
LocalScope* parent_scope = |
@@ -2616,7 +2567,6 @@ ISOLATE_UNIT_TEST_CASE(ContextScope) { |
var_c->owner()->context_level()); // Adjusted context level. |
} |
- |
ISOLATE_UNIT_TEST_CASE(Closure) { |
// Allocate the class first. |
const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); |
@@ -2648,7 +2598,6 @@ ISOLATE_UNIT_TEST_CASE(Closure) { |
EXPECT_EQ(closure_context.raw(), context.raw()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(ObjectPrinting) { |
// Simple Smis. |
EXPECT_STREQ("2", Smi::Handle(Smi::New(2)).ToCString()); |
@@ -2666,7 +2615,6 @@ ISOLATE_UNIT_TEST_CASE(ObjectPrinting) { |
String::Handle(String::New("Sugarbowl")).ToCString()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(CheckedHandle) { |
// Ensure that null handles have the correct C++ vtable setup. |
const String& str1 = String::Handle(); |
@@ -2688,12 +2636,10 @@ ISOLATE_UNIT_TEST_CASE(CheckedHandle) { |
EXPECT(!str3.IsOneByteString()); |
} |
- |
static RawLibrary* CreateDummyLibrary(const String& library_name) { |
return Library::New(library_name); |
} |
- |
static RawFunction* CreateFunction(const char* name) { |
Thread* thread = Thread::Current(); |
const String& class_name = String::Handle(Symbols::New(thread, "ownerClass")); |
@@ -2709,7 +2655,6 @@ static RawFunction* CreateFunction(const char* name) { |
TokenPosition::kMinSource); |
} |
- |
// Test for Code and Instruction object creation. |
ISOLATE_UNIT_TEST_CASE(Code) { |
extern void GenerateIncrement(Assembler * assembler); |
@@ -2726,7 +2671,6 @@ ISOLATE_UNIT_TEST_CASE(Code) { |
EXPECT_EQ(1, Smi::Cast(result).Value()); |
} |
- |
// Test for immutability of generated instructions. The test crashes with a |
// segmentation fault when writing into it. |
ISOLATE_UNIT_TEST_CASE(CodeImmutability) { |
@@ -2754,7 +2698,6 @@ ISOLATE_UNIT_TEST_CASE(CodeImmutability) { |
stack_trace_collection_enabled); |
} |
- |
// Test for Embedded String object in the instructions. |
ISOLATE_UNIT_TEST_CASE(EmbedStringInCode) { |
extern void GenerateEmbedStringInCode(Assembler * assembler, const char* str); |
@@ -2777,7 +2720,6 @@ ISOLATE_UNIT_TEST_CASE(EmbedStringInCode) { |
} |
} |
- |
// Test for Embedded Smi object in the instructions. |
ISOLATE_UNIT_TEST_CASE(EmbedSmiInCode) { |
extern void GenerateEmbedSmiInCode(Assembler * assembler, intptr_t value); |
@@ -2793,7 +2735,6 @@ ISOLATE_UNIT_TEST_CASE(EmbedSmiInCode) { |
EXPECT(Smi::Cast(result).Value() == kSmiTestValue); |
} |
- |
#if defined(ARCH_IS_64_BIT) |
// Test for Embedded Smi object in the instructions. |
ISOLATE_UNIT_TEST_CASE(EmbedSmiIn64BitCode) { |
@@ -2811,7 +2752,6 @@ ISOLATE_UNIT_TEST_CASE(EmbedSmiIn64BitCode) { |
} |
#endif // ARCH_IS_64_BIT |
- |
ISOLATE_UNIT_TEST_CASE(ExceptionHandlers) { |
const int kNumEntries = 4; |
// Add an exception handler table to the code. |
@@ -2853,7 +2793,6 @@ ISOLATE_UNIT_TEST_CASE(ExceptionHandlers) { |
EXPECT(handlers.HasCatchAll(3)); |
} |
- |
ISOLATE_UNIT_TEST_CASE(PcDescriptors) { |
DescriptorList* builder = new DescriptorList(0); |
@@ -2911,7 +2850,6 @@ ISOLATE_UNIT_TEST_CASE(PcDescriptors) { |
EXPECT_EQ(false, iter.MoveNext()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(PcDescriptorsLargeDeltas) { |
DescriptorList* builder = new DescriptorList(0); |
@@ -2973,7 +2911,6 @@ ISOLATE_UNIT_TEST_CASE(PcDescriptorsLargeDeltas) { |
EXPECT_EQ(false, iter.MoveNext()); |
} |
- |
static RawClass* CreateTestClass(const char* name) { |
const String& class_name = |
String::Handle(Symbols::New(Thread::Current(), name)); |
@@ -2982,7 +2919,6 @@ static RawClass* CreateTestClass(const char* name) { |
return cls.raw(); |
} |
- |
static RawField* CreateTestField(const char* name) { |
const Class& cls = Class::Handle(CreateTestClass("global:")); |
const String& field_name = |
@@ -2993,7 +2929,6 @@ static RawField* CreateTestField(const char* name) { |
return field.raw(); |
} |
- |
ISOLATE_UNIT_TEST_CASE(ClassDictionaryIterator) { |
Class& ae66 = Class::ZoneHandle(CreateTestClass("Ae6/6")); |
Class& re44 = Class::ZoneHandle(CreateTestClass("Re4/4")); |
@@ -3016,7 +2951,6 @@ ISOLATE_UNIT_TEST_CASE(ClassDictionaryIterator) { |
EXPECT(count == 2); |
} |
- |
static RawFunction* GetDummyTarget(const char* name) { |
const String& function_name = |
String::Handle(Symbols::New(Thread::Current(), name)); |
@@ -3032,7 +2966,6 @@ static RawFunction* GetDummyTarget(const char* name) { |
TokenPosition::kMinSource); |
} |
- |
ISOLATE_UNIT_TEST_CASE(ICData) { |
Function& function = Function::Handle(GetDummyTarget("Bern")); |
const intptr_t id = 12; |
@@ -3107,7 +3040,6 @@ ISOLATE_UNIT_TEST_CASE(ICData) { |
EXPECT_EQ(target1.raw(), scall_icdata.GetTargetAt(0)); |
} |
- |
ISOLATE_UNIT_TEST_CASE(SubtypeTestCache) { |
String& class_name = String::Handle(Symbols::New(thread, "EmptyClass")); |
Script& script = Script::Handle(); |
@@ -3136,7 +3068,6 @@ ISOLATE_UNIT_TEST_CASE(SubtypeTestCache) { |
EXPECT_EQ(Bool::True().raw(), test_result.raw()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(FieldTests) { |
const String& f = String::Handle(String::New("oneField")); |
const String& getter_f = String::Handle(Field::GetterName(f)); |
@@ -3153,11 +3084,9 @@ ISOLATE_UNIT_TEST_CASE(FieldTests) { |
String::Handle(Field::NameFromSetter(setter_f)).ToCString()); |
} |
- |
// Expose helper function from object.cc for testing. |
bool EqualsIgnoringPrivate(const String& name, const String& private_name); |
- |
ISOLATE_UNIT_TEST_CASE(EqualsIgnoringPrivate) { |
String& mangled_name = String::Handle(); |
String& bare_name = String::Handle(); |
@@ -3300,12 +3229,10 @@ ISOLATE_UNIT_TEST_CASE(EqualsIgnoringPrivate) { |
!String::EqualsIgnoringPrivateKey(ext_mangled_name, ext_bad_bare_name)); |
} |
- |
ISOLATE_UNIT_TEST_CASE(ArrayNew_Overflow_Crash) { |
Array::Handle(Array::New(Array::kMaxElements + 1)); |
} |
- |
TEST_CASE(StackTraceFormat) { |
const char* kScriptChars = |
"void baz() {\n" |
@@ -3365,7 +3292,6 @@ TEST_CASE(StackTraceFormat) { |
"#10 main (test-lib:37:24)"); |
} |
- |
ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveCrossGen) { |
Isolate* isolate = Isolate::Current(); |
WeakProperty& weak = WeakProperty::Handle(); |
@@ -3481,7 +3407,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveCrossGen) { |
EXPECT(weak.value() != Object::null()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveRecurse) { |
// This used to end in an infinite recursion. Caused by scavenging the weak |
// property before scavenging the key. |
@@ -3504,7 +3429,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveRecurse) { |
EXPECT(weak.value() != Object::null()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveOne_NewSpace) { |
Isolate* isolate = Isolate::Current(); |
WeakProperty& weak = WeakProperty::Handle(); |
@@ -3523,7 +3447,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveOne_NewSpace) { |
EXPECT(weak.value() != Object::null()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwo_NewSpace) { |
Isolate* isolate = Isolate::Current(); |
WeakProperty& weak1 = WeakProperty::Handle(); |
@@ -3552,7 +3475,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwo_NewSpace) { |
EXPECT(weak2.value() != Object::null()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwoShared_NewSpace) { |
Isolate* isolate = Isolate::Current(); |
WeakProperty& weak1 = WeakProperty::Handle(); |
@@ -3579,7 +3501,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwoShared_NewSpace) { |
EXPECT(weak2.value() != Object::null()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveOne_OldSpace) { |
Isolate* isolate = Isolate::Current(); |
WeakProperty& weak = WeakProperty::Handle(); |
@@ -3598,7 +3519,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveOne_OldSpace) { |
EXPECT(weak.value() != Object::null()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwo_OldSpace) { |
Isolate* isolate = Isolate::Current(); |
WeakProperty& weak1 = WeakProperty::Handle(); |
@@ -3627,7 +3547,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwo_OldSpace) { |
EXPECT(weak2.value() != Object::null()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwoShared_OldSpace) { |
Isolate* isolate = Isolate::Current(); |
WeakProperty& weak1 = WeakProperty::Handle(); |
@@ -3654,7 +3573,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwoShared_OldSpace) { |
EXPECT(weak2.value() != Object::null()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearOne_NewSpace) { |
Isolate* isolate = Isolate::Current(); |
WeakProperty& weak = WeakProperty::Handle(); |
@@ -3675,7 +3593,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearOne_NewSpace) { |
EXPECT(weak.value() == Object::null()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearTwoShared_NewSpace) { |
Isolate* isolate = Isolate::Current(); |
WeakProperty& weak1 = WeakProperty::Handle(); |
@@ -3702,7 +3619,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearTwoShared_NewSpace) { |
EXPECT(weak2.value() == Object::null()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearOne_OldSpace) { |
Isolate* isolate = Isolate::Current(); |
WeakProperty& weak = WeakProperty::Handle(); |
@@ -3723,7 +3639,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearOne_OldSpace) { |
EXPECT(weak.value() == Object::null()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearTwoShared_OldSpace) { |
Isolate* isolate = Isolate::Current(); |
WeakProperty& weak1 = WeakProperty::Handle(); |
@@ -3750,7 +3665,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearTwoShared_OldSpace) { |
EXPECT(weak2.value() == Object::null()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(MirrorReference) { |
const MirrorReference& reference = |
MirrorReference::Handle(MirrorReference::New(Object::Handle())); |
@@ -3776,7 +3690,6 @@ ISOLATE_UNIT_TEST_CASE(MirrorReference) { |
EXPECT(obj.IsMirrorReference()); |
} |
- |
static RawFunction* GetFunction(const Class& cls, const char* name) { |
const Function& result = Function::Handle( |
cls.LookupDynamicFunction(String::Handle(String::New(name)))); |
@@ -3784,7 +3697,6 @@ static RawFunction* GetFunction(const Class& cls, const char* name) { |
return result.raw(); |
} |
- |
static RawFunction* GetStaticFunction(const Class& cls, const char* name) { |
const Function& result = Function::Handle( |
cls.LookupStaticFunction(String::Handle(String::New(name)))); |
@@ -3792,7 +3704,6 @@ static RawFunction* GetStaticFunction(const Class& cls, const char* name) { |
return result.raw(); |
} |
- |
static RawField* GetField(const Class& cls, const char* name) { |
const Field& field = |
Field::Handle(cls.LookupField(String::Handle(String::New(name)))); |
@@ -3800,7 +3711,6 @@ static RawField* GetField(const Class& cls, const char* name) { |
return field.raw(); |
} |
- |
static RawClass* GetClass(const Library& lib, const char* name) { |
const Class& cls = Class::Handle( |
lib.LookupClass(String::Handle(Symbols::New(Thread::Current(), name)))); |
@@ -3808,7 +3718,6 @@ static RawClass* GetClass(const Library& lib, const char* name) { |
return cls.raw(); |
} |
- |
ISOLATE_UNIT_TEST_CASE(FindClosureIndex) { |
// Allocate the class first. |
const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); |
@@ -3846,7 +3755,6 @@ ISOLATE_UNIT_TEST_CASE(FindClosureIndex) { |
EXPECT_EQ(func_from_index.raw(), function.raw()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(FindInvocationDispatcherFunctionIndex) { |
const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); |
const Script& script = Script::Handle(); |
@@ -3891,7 +3799,6 @@ ISOLATE_UNIT_TEST_CASE(FindInvocationDispatcherFunctionIndex) { |
EXPECT_EQ(bad_invocation_dispatcher_index, -1); |
} |
- |
static void PrintMetadata(const char* name, const Object& data) { |
if (data.IsError()) { |
OS::Print("Error in metadata evaluation for %s: '%s'\n", name, |
@@ -3907,7 +3814,6 @@ static void PrintMetadata(const char* name, const Object& data) { |
} |
} |
- |
TEST_CASE(Metadata) { |
const char* kScriptChars = |
"@metafoo \n" |
@@ -3981,7 +3887,6 @@ TEST_CASE(Metadata) { |
PrintMetadata("gVar", res); |
} |
- |
TEST_CASE(FunctionSourceFingerprint) { |
const char* kScriptChars = |
"class A {\n" |
@@ -4060,7 +3965,6 @@ TEST_CASE(FunctionSourceFingerprint) { |
EXPECT_EQ(a_test6.SourceFingerprint(), b_test6.SourceFingerprint()); |
} |
- |
TEST_CASE(FunctionWithBreakpointNotInlined) { |
if (!FLAG_support_debugger) { |
return; |
@@ -4099,7 +4003,6 @@ TEST_CASE(FunctionWithBreakpointNotInlined) { |
EXPECT(!func_b.CanBeInlined()); |
} |
- |
ISOLATE_UNIT_TEST_CASE(SpecialClassesHaveEmptyArrays) { |
ObjectStore* object_store = Isolate::Current()->object_store(); |
Class& cls = Class::Handle(); |
@@ -4130,10 +4033,8 @@ ISOLATE_UNIT_TEST_CASE(SpecialClassesHaveEmptyArrays) { |
EXPECT(array.IsArray()); |
} |
- |
#ifndef PRODUCT |
- |
class ObjectAccumulator : public ObjectVisitor { |
public: |
explicit ObjectAccumulator(GrowableArray<Object*>* objects) |
@@ -4155,7 +4056,6 @@ class ObjectAccumulator : public ObjectVisitor { |
GrowableArray<Object*>* objects_; |
}; |
- |
ISOLATE_UNIT_TEST_CASE(PrintJSON) { |
Heap* heap = Isolate::Current()->heap(); |
heap->CollectAllGarbage(); |
@@ -4169,7 +4069,6 @@ ISOLATE_UNIT_TEST_CASE(PrintJSON) { |
} |
} |
- |
ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) { |
char buffer[1024]; |
Isolate* isolate = Isolate::Current(); |
@@ -4459,10 +4358,8 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) { |
} |
} |
- |
#endif // !PRODUCT |
- |
TEST_CASE(InstanceEquality) { |
// Test that Instance::OperatorEquals can call a user-defined operator==. |
const char* kScript = |
@@ -4491,7 +4388,6 @@ TEST_CASE(InstanceEquality) { |
EXPECT(!a0.IsIdenticalTo(a1)); |
} |
- |
TEST_CASE(HashCode) { |
// Ensure C++ overrides of Instance::HashCode match the Dart implementations. |
const char* kScript = |
@@ -4514,7 +4410,6 @@ TEST_CASE(HashCode) { |
EXPECT(result.IsIdenticalTo(expected)); |
} |
- |
static void CheckIdenticalHashStructure(const Instance& a, const Instance& b) { |
const char* kScript = |
"(a, b) {\n" |
@@ -4553,7 +4448,6 @@ static void CheckIdenticalHashStructure(const Instance& a, const Instance& b) { |
EXPECT(lib.Evaluate(name, param_names, param_values) == Bool::True().raw()); |
} |
- |
TEST_CASE(LinkedHashMap) { |
// Check that initial index size and hash mask match in Dart vs. C++. |
// 1. Create an empty custom linked hash map in Dart. |
@@ -4581,7 +4475,6 @@ TEST_CASE(LinkedHashMap) { |
CheckIdenticalHashStructure(dart_map, cc_map); |
} |
- |
TEST_CASE(LinkedHashMap_iteration) { |
const char* kScript = |
"makeMap() {\n" |
@@ -4623,7 +4516,6 @@ TEST_CASE(LinkedHashMap_iteration) { |
EXPECT(!iterator.MoveNext()); |
} |
- |
static void CheckConcatAll(const String* data[], intptr_t n) { |
Thread* thread = Thread::Current(); |
Zone* zone = thread->zone(); |
@@ -4639,7 +4531,6 @@ static void CheckConcatAll(const String* data[], intptr_t n) { |
EXPECT(res1.Equals(res2)); |
} |
- |
ISOLATE_UNIT_TEST_CASE(Symbols_FromConcatAll) { |
{ |
const String* data[3] = {&Symbols::FallThroughError(), &Symbols::Dot(), |
@@ -4703,13 +4594,11 @@ ISOLATE_UNIT_TEST_CASE(Symbols_FromConcatAll) { |
} |
} |
- |
struct TestResult { |
const char* in; |
const char* out; |
}; |
- |
ISOLATE_UNIT_TEST_CASE(String_ScrubName) { |
TestResult tests[] = { |
{"(dynamic, dynamic) => void", "(dynamic, dynamic) => void"}, |
@@ -4736,7 +4625,6 @@ ISOLATE_UNIT_TEST_CASE(String_ScrubName) { |
} |
} |
- |
ISOLATE_UNIT_TEST_CASE(String_EqualsUTF32) { |
// Regression test for Issue 27433. Checks that comparisons between Strings |
// and utf32 arrays happens after conversion to utf16 instead of utf32, as |