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

Side by Side Diff: test/cctest/compiler/compiler/test-run-jsexceptions.cc

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "src/v8.h"
6
7 #include "test/cctest/compiler/function-tester.h"
8
9 using namespace v8::internal;
10 using namespace v8::internal::compiler;
11
12 TEST(Throw) {
13 FunctionTester T("(function(a,b) { if (a) { throw b; } else { return b; }})");
14
15 T.CheckThrows(T.true_value(), T.NewObject("new Error"));
16 T.CheckCall(T.Val(23), T.false_value(), T.Val(23));
17 }
18
19
20 TEST(ThrowSourcePosition) {
21 static const char* src =
22 "(function(a, b) { \n"
23 " if (a == 1) throw 1; \n"
24 " if (a == 2) {throw 2} \n"
25 " if (a == 3) {0;throw 3}\n"
26 " throw 4; \n"
27 "}) ";
28 FunctionTester T(src);
29 v8::Handle<v8::Message> message;
30
31 message = T.CheckThrowsReturnMessage(T.Val(1), T.undefined());
32 CHECK(!message.IsEmpty());
33 CHECK_EQ(2, message->GetLineNumber());
34 CHECK_EQ(40, message->GetStartPosition());
35
36 message = T.CheckThrowsReturnMessage(T.Val(2), T.undefined());
37 CHECK(!message.IsEmpty());
38 CHECK_EQ(3, message->GetLineNumber());
39 CHECK_EQ(67, message->GetStartPosition());
40
41 message = T.CheckThrowsReturnMessage(T.Val(3), T.undefined());
42 CHECK(!message.IsEmpty());
43 CHECK_EQ(4, message->GetLineNumber());
44 CHECK_EQ(95, message->GetStartPosition());
45 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/compiler/test-run-jscalls.cc ('k') | test/cctest/compiler/compiler/test-run-jsops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698