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

Side by Side Diff: test/cctest/test-strings.cc

Issue 1087633005: Start migrating error message templates to the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix windows build Created 5 years, 8 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 | « src/weak-collection.js ('k') | tools/gyp/v8.gyp » ('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 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 18 matching lines...) Expand all
29 // StringCharacterStram. Check that Get(int) works on very deep stacks 29 // StringCharacterStram. Check that Get(int) works on very deep stacks
30 // of ConsStrings. These operations may not be very fast, but they 30 // of ConsStrings. These operations may not be very fast, but they
31 // should be possible without getting errors due to too deep recursion. 31 // should be possible without getting errors due to too deep recursion.
32 32
33 #include <stdlib.h> 33 #include <stdlib.h>
34 34
35 #include "src/v8.h" 35 #include "src/v8.h"
36 36
37 #include "src/api.h" 37 #include "src/api.h"
38 #include "src/factory.h" 38 #include "src/factory.h"
39 #include "src/messages.h"
39 #include "src/objects.h" 40 #include "src/objects.h"
40 #include "src/unicode-decoder.h" 41 #include "src/unicode-decoder.h"
41 #include "test/cctest/cctest.h" 42 #include "test/cctest/cctest.h"
42 43
43 // Adapted from http://en.wikipedia.org/wiki/Multiply-with-carry 44 // Adapted from http://en.wikipedia.org/wiki/Multiply-with-carry
44 class MyRandomNumberGenerator { 45 class MyRandomNumberGenerator {
45 public: 46 public:
46 MyRandomNumberGenerator() { 47 MyRandomNumberGenerator() {
47 init(); 48 init();
48 } 49 }
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 CHECK(isolate->has_pending_exception()); \ 1453 CHECK(isolate->has_pending_exception()); \
1453 isolate->clear_pending_exception(); \ 1454 isolate->clear_pending_exception(); \
1454 dummy.Dispose(); \ 1455 dummy.Dispose(); \
1455 } 1456 }
1456 1457
1457 INVALID_STRING_TEST(NewStringFromAscii, char) 1458 INVALID_STRING_TEST(NewStringFromAscii, char)
1458 INVALID_STRING_TEST(NewStringFromUtf8, char) 1459 INVALID_STRING_TEST(NewStringFromUtf8, char)
1459 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) 1460 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t)
1460 1461
1461 #undef INVALID_STRING_TEST 1462 #undef INVALID_STRING_TEST
1463
1464
1465 TEST(FormatMessage) {
1466 CcTest::InitializeVM();
1467 LocalContext context;
1468 Isolate* isolate = CcTest::i_isolate();
1469 HandleScope scope(isolate);
1470 Handle<String> arg0 = isolate->factory()->NewStringFromAsciiChecked("arg0");
1471 Handle<String> arg1 = isolate->factory()->NewStringFromAsciiChecked("arg1");
1472 Handle<String> arg2 = isolate->factory()->NewStringFromAsciiChecked("arg2");
1473 Handle<String> result =
1474 MessageTemplate::FormatMessage(MessageTemplate::kPropertyNotFunction,
1475 arg0, arg1, arg2).ToHandleChecked();
1476 Handle<String> expected = isolate->factory()->NewStringFromAsciiChecked(
1477 "Property 'arg0' of object arg1 is not a function");
1478 CHECK(String::Equals(result, expected));
1479 }
OLDNEW
« no previous file with comments | « src/weak-collection.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698