31 v8::Context::Scope context_scope(current_engine->GetV8Context());
32 v8::Local<v8::Object> This = current_engine->GetThisObj();
33 v8::Local<v8::Value> fred = current_engine->GetObjectProperty(This,
"fred");
34 EXPECT_TRUE(fred->IsNumber());
35 EXPECT_EQ(expected, current_engine->ToDouble(fred));
39 v8::Isolate::Scope isolate_scope(isolate());
40 v8::HandleScope handle_scope(isolate());
41 v8::Context::Scope context_scope(GetV8Context());
43 absl::optional<IJS_Runtime::JS_Error> err =
44 engine()->Execute(WideString(kScript1));
46 CheckAssignmentInEngineContext(engine(), kExpected1);
50 v8::Isolate::Scope isolate_scope(isolate());
51 v8::HandleScope handle_scope(isolate());
59 v8::Context::Scope context_scope(GetV8Context());
61 absl::optional<IJS_Runtime::JS_Error> err =
62 engine()->Execute(WideString(kScript0));
64 CheckAssignmentInEngineContext(engine(), kExpected0);
68 v8::Context::Scope context_scope1(engine1.GetV8Context());
69 absl::optional<IJS_Runtime::JS_Error> err =
70 engine1.Execute(WideString(kScript1));
72 CheckAssignmentInEngineContext(engine(), kExpected0);
77 v8::Context::Scope context_scope2(engine2.GetV8Context());
78 absl::optional<IJS_Runtime::JS_Error> err =
79 engine1.Execute(WideString(kScript2));
81 CheckAssignmentInEngineContext(engine(), kExpected0);
90 v8::Isolate::Scope isolate_scope(isolate());
91 v8::HandleScope handle_scope(isolate());
92 v8::Context::Scope context_scope(GetV8Context());
94 absl::optional<IJS_Runtime::JS_Error> err =
95 engine()->Execute(L"functoon(x) { return x+1; }");
97 EXPECT_STREQ(L"SyntaxError: Unexpected token '{'", err->exception.c_str());
98 EXPECT_EQ(1, err->line);
99 EXPECT_EQ(12, err->column);
103 v8::Isolate::Scope isolate_scope(isolate());
104 v8::HandleScope handle_scope(isolate());
105 v8::Context::Scope context_scope(GetV8Context());
107 absl::optional<IJS_Runtime::JS_Error> err =
108 engine()->Execute(L"let a = 3;\nundefined.colour");
111 L"TypeError: Cannot read properties of undefined (reading 'colour')",
113 EXPECT_EQ(2, err->line);
114 EXPECT_EQ(10, err->column);