OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 }; | 1078 }; |
1079 | 1079 |
1080 const char* line; | 1080 const char* line; |
1081 for (int i = 0; (line = lines[i]); i++) { | 1081 for (int i = 0; (line = lines[i]); i++) { |
1082 printf("%s\n", line); | 1082 printf("%s\n", line); |
1083 v8::Local<v8::Value> result = v8::Script::Compile( | 1083 v8::Local<v8::Value> result = v8::Script::Compile( |
1084 v8::String::NewFromUtf8(CcTest::isolate(), line))->Run(); | 1084 v8::String::NewFromUtf8(CcTest::isolate(), line))->Run(); |
1085 CHECK_EQ(results[i]->IsUndefined(), result->IsUndefined()); | 1085 CHECK_EQ(results[i]->IsUndefined(), result->IsUndefined()); |
1086 CHECK_EQ(results[i]->IsNumber(), result->IsNumber()); | 1086 CHECK_EQ(results[i]->IsNumber(), result->IsNumber()); |
1087 if (result->IsNumber()) { | 1087 if (result->IsNumber()) { |
1088 CHECK_EQ(Object::ToSmi(isolate, results[i]).ToHandleChecked()->value(), | 1088 int32_t value = 0; |
1089 result->ToInt32(CcTest::isolate())->Value()); | 1089 CHECK(results[i]->ToInt32(&value)); |
| 1090 CHECK_EQ(value, result->ToInt32(CcTest::isolate())->Value()); |
1090 } | 1091 } |
1091 } | 1092 } |
1092 } | 1093 } |
1093 | 1094 |
1094 | 1095 |
1095 TEST(SliceFromCons) { | 1096 TEST(SliceFromCons) { |
1096 FLAG_string_slices = true; | 1097 FLAG_string_slices = true; |
1097 CcTest::InitializeVM(); | 1098 CcTest::InitializeVM(); |
1098 Factory* factory = CcTest::i_isolate()->factory(); | 1099 Factory* factory = CcTest::i_isolate()->factory(); |
1099 v8::HandleScope scope(CcTest::isolate()); | 1100 v8::HandleScope scope(CcTest::isolate()); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 Handle<String> arg0 = isolate->factory()->NewStringFromAsciiChecked("arg0"); | 1472 Handle<String> arg0 = isolate->factory()->NewStringFromAsciiChecked("arg0"); |
1472 Handle<String> arg1 = isolate->factory()->NewStringFromAsciiChecked("arg1"); | 1473 Handle<String> arg1 = isolate->factory()->NewStringFromAsciiChecked("arg1"); |
1473 Handle<String> arg2 = isolate->factory()->NewStringFromAsciiChecked("arg2"); | 1474 Handle<String> arg2 = isolate->factory()->NewStringFromAsciiChecked("arg2"); |
1474 Handle<String> result = | 1475 Handle<String> result = |
1475 MessageTemplate::FormatMessage(MessageTemplate::kPropertyNotFunction, | 1476 MessageTemplate::FormatMessage(MessageTemplate::kPropertyNotFunction, |
1476 arg0, arg1, arg2).ToHandleChecked(); | 1477 arg0, arg1, arg2).ToHandleChecked(); |
1477 Handle<String> expected = isolate->factory()->NewStringFromAsciiChecked( | 1478 Handle<String> expected = isolate->factory()->NewStringFromAsciiChecked( |
1478 "Property 'arg0' of object arg1 is not a function"); | 1479 "Property 'arg0' of object arg1 is not a function"); |
1479 CHECK(String::Equals(result, expected)); | 1480 CHECK(String::Equals(result, expected)); |
1480 } | 1481 } |
OLD | NEW |