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 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 | 1375 |
1376 TEST(IsAscii) { | 1376 TEST(IsAscii) { |
1377 CHECK(String::IsAscii(static_cast<char*>(NULL), 0)); | 1377 CHECK(String::IsAscii(static_cast<char*>(NULL), 0)); |
1378 CHECK(String::IsOneByte(static_cast<uc16*>(NULL), 0)); | 1378 CHECK(String::IsOneByte(static_cast<uc16*>(NULL), 0)); |
1379 } | 1379 } |
1380 | 1380 |
1381 | 1381 |
1382 | 1382 |
1383 template<typename Op, bool return_first> | 1383 template<typename Op, bool return_first> |
1384 static uint16_t ConvertLatin1(uint16_t c) { | 1384 static uint16_t ConvertLatin1(uint16_t c) { |
1385 uc32 result[Op::kMaxWidth]; | 1385 uint32_t result[Op::kMaxWidth]; |
1386 int chars; | 1386 int chars; |
1387 chars = Op::Convert(c, 0, result, NULL); | 1387 chars = Op::Convert(c, 0, result, NULL); |
1388 if (chars == 0) return 0; | 1388 if (chars == 0) return 0; |
1389 CHECK_LE(chars, static_cast<int>(sizeof(result))); | 1389 CHECK_LE(chars, static_cast<int>(sizeof(result))); |
1390 if (!return_first && chars > 1) { | 1390 if (!return_first && chars > 1) { |
1391 return 0; | 1391 return 0; |
1392 } | 1392 } |
1393 return result[0]; | 1393 return result[0]; |
1394 } | 1394 } |
1395 | 1395 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 Handle<String> arg0 = isolate->factory()->NewStringFromAsciiChecked("arg0"); | 1501 Handle<String> arg0 = isolate->factory()->NewStringFromAsciiChecked("arg0"); |
1502 Handle<String> arg1 = isolate->factory()->NewStringFromAsciiChecked("arg1"); | 1502 Handle<String> arg1 = isolate->factory()->NewStringFromAsciiChecked("arg1"); |
1503 Handle<String> arg2 = isolate->factory()->NewStringFromAsciiChecked("arg2"); | 1503 Handle<String> arg2 = isolate->factory()->NewStringFromAsciiChecked("arg2"); |
1504 Handle<String> result = | 1504 Handle<String> result = |
1505 MessageTemplate::FormatMessage(MessageTemplate::kPropertyNotFunction, | 1505 MessageTemplate::FormatMessage(MessageTemplate::kPropertyNotFunction, |
1506 arg0, arg1, arg2).ToHandleChecked(); | 1506 arg0, arg1, arg2).ToHandleChecked(); |
1507 Handle<String> expected = isolate->factory()->NewStringFromAsciiChecked( | 1507 Handle<String> expected = isolate->factory()->NewStringFromAsciiChecked( |
1508 "'arg0' returned for property 'arg1' of object 'arg2' is not a function"); | 1508 "'arg0' returned for property 'arg1' of object 'arg2' is not a function"); |
1509 CHECK(String::Equals(result, expected)); | 1509 CHECK(String::Equals(result, expected)); |
1510 } | 1510 } |
OLD | NEW |