| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/class_finalizer.h" | 6 #include "vm/class_finalizer.h" |
| 7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 "get dot => '.'; \n" | 74 "get dot => '.'; \n" |
| 75 "class A { \n" | 75 "class A { \n" |
| 76 " var apa = 'Herr Nilsson'; \n" | 76 " var apa = 'Herr Nilsson'; \n" |
| 77 " calc(x) => '${x*ten}'; \n" | 77 " calc(x) => '${x*ten}'; \n" |
| 78 "} \n" | 78 "} \n" |
| 79 "makeObj() => new A(); \n"; | 79 "makeObj() => new A(); \n"; |
| 80 | 80 |
| 81 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 81 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 82 Dart_Handle obj_handle = | 82 Dart_Handle obj_handle = |
| 83 Dart_Invoke(lib, Dart_NewStringFromCString("makeObj"), 0, NULL); | 83 Dart_Invoke(lib, Dart_NewStringFromCString("makeObj"), 0, NULL); |
| 84 NativeToVmTimerScope timer(Isolate::Current()); | |
| 85 EXPECT(!Dart_IsNull(obj_handle)); | 84 EXPECT(!Dart_IsNull(obj_handle)); |
| 86 EXPECT(!Dart_IsError(obj_handle)); | 85 EXPECT(!Dart_IsError(obj_handle)); |
| 87 const Object& obj = Object::Handle(Api::UnwrapHandle(obj_handle)); | 86 const Object& obj = Object::Handle(Api::UnwrapHandle(obj_handle)); |
| 88 EXPECT(!obj.IsNull()); | 87 EXPECT(!obj.IsNull()); |
| 89 EXPECT(obj.IsInstance()); | 88 EXPECT(obj.IsInstance()); |
| 90 | 89 |
| 91 String& expr_text = String::Handle(); | 90 String& expr_text = String::Handle(); |
| 92 expr_text = String::New("apa + ' ${calc(10)}' + dot"); | 91 expr_text = String::New("apa + ' ${calc(10)}' + dot"); |
| 93 Object& val = Object::Handle(); | 92 Object& val = Object::Handle(); |
| 94 val = Instance::Cast(obj).Evaluate(expr_text); | 93 val = Instance::Cast(obj).Evaluate(expr_text); |
| 95 EXPECT(!val.IsNull()); | 94 EXPECT(!val.IsNull()); |
| 96 EXPECT(!val.IsError()); | 95 EXPECT(!val.IsError()); |
| 97 EXPECT(val.IsString()); | 96 EXPECT(val.IsString()); |
| 98 EXPECT_STREQ("Herr Nilsson 100.", val.ToCString()); | 97 EXPECT_STREQ("Herr Nilsson 100.", val.ToCString()); |
| 99 } | 98 } |
| 100 | 99 |
| 101 } // namespace dart | 100 } // namespace dart |
| OLD | NEW |