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

Unified Diff: test/cctest/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, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/compiler/test-run-jscalls.cc ('k') | test/cctest/compiler/test-run-jsops.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-run-jsexceptions.cc
diff --git a/test/cctest/compiler/test-run-jsexceptions.cc b/test/cctest/compiler/test-run-jsexceptions.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0712ab62057d742eef946eb74b3c4cc0a6e5e0ab
--- /dev/null
+++ b/test/cctest/compiler/test-run-jsexceptions.cc
@@ -0,0 +1,45 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/v8.h"
+
+#include "test/cctest/compiler/function-tester.h"
+
+using namespace v8::internal;
+using namespace v8::internal::compiler;
+
+TEST(Throw) {
+ FunctionTester T("(function(a,b) { if (a) { throw b; } else { return b; }})");
+
+ T.CheckThrows(T.true_value(), T.NewObject("new Error"));
+ T.CheckCall(T.Val(23), T.false_value(), T.Val(23));
+}
+
+
+TEST(ThrowSourcePosition) {
+ static const char* src =
+ "(function(a, b) { \n"
+ " if (a == 1) throw 1; \n"
+ " if (a == 2) {throw 2} \n"
+ " if (a == 3) {0;throw 3}\n"
+ " throw 4; \n"
+ "}) ";
+ FunctionTester T(src);
+ v8::Handle<v8::Message> message;
+
+ message = T.CheckThrowsReturnMessage(T.Val(1), T.undefined());
+ CHECK(!message.IsEmpty());
+ CHECK_EQ(2, message->GetLineNumber());
+ CHECK_EQ(40, message->GetStartPosition());
+
+ message = T.CheckThrowsReturnMessage(T.Val(2), T.undefined());
+ CHECK(!message.IsEmpty());
+ CHECK_EQ(3, message->GetLineNumber());
+ CHECK_EQ(67, message->GetStartPosition());
+
+ message = T.CheckThrowsReturnMessage(T.Val(3), T.undefined());
+ CHECK(!message.IsEmpty());
+ CHECK_EQ(4, message->GetLineNumber());
+ CHECK_EQ(95, message->GetStartPosition());
+}
« no previous file with comments | « test/cctest/compiler/test-run-jscalls.cc ('k') | test/cctest/compiler/test-run-jsops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698