1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "ecmascript/global_env.h" 17 #include "ecmascript/js_async_generator_object.h" 18 #include "ecmascript/interpreter/slow_runtime_stub.h" 19 #include "ecmascript/tests/test_helper.h" 20 21 using namespace panda; 22 using namespace panda::ecmascript; 23 24 namespace panda::test { 25 class JSAsyncGeneratorObjectTest : public BaseTestWithScope<false> { 26 }; 27 28 /** 29 * @tc.name: GeneratorValidate 30 * @tc.desc: Get the current status of the AsyncGenerator. 31 * @tc.type: FUNC 32 * @tc.require:issueI5JIGT 33 */ HWTEST_F_L0(JSAsyncGeneratorObjectTest,AsyncGeneratorValidate_001)34HWTEST_F_L0(JSAsyncGeneratorObjectTest, AsyncGeneratorValidate_001) 35 { 36 auto vm = thread->GetEcmaVM(); 37 auto factory = vm->GetFactory(); 38 auto env = vm->GetGlobalEnv(); 39 JSHandle<JSAsyncGeneratorObject> asyncGenObj = 40 factory->NewJSAsyncGeneratorObject(env->GetAsyncGeneratorFunctionFunction()); 41 JSAsyncGeneratorState state = asyncGenObj->GetAsyncGeneratorState(); 42 EXPECT_EQ(state, JSAsyncGeneratorState::UNDEFINED); 43 } 44 } // namespace panda::test