11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_cirequire('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst { 71cb0ef41Sopenharmony_ci isBuildingSnapshot, 81cb0ef41Sopenharmony_ci addSerializeCallback, 91cb0ef41Sopenharmony_ci addDeserializeCallback, 101cb0ef41Sopenharmony_ci setDeserializeMainFunction 111cb0ef41Sopenharmony_ci} = require('v8').startupSnapshot; 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci// This test verifies that the v8.startupSnapshot APIs are not available when 141cb0ef41Sopenharmony_ci// it is not building snapshot. 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ciassert(!isBuildingSnapshot()); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciassert.throws(() => addSerializeCallback(() => {}), { 191cb0ef41Sopenharmony_ci code: 'ERR_NOT_BUILDING_SNAPSHOT', 201cb0ef41Sopenharmony_ci}); 211cb0ef41Sopenharmony_ciassert.throws(() => addDeserializeCallback(() => {}), { 221cb0ef41Sopenharmony_ci code: 'ERR_NOT_BUILDING_SNAPSHOT', 231cb0ef41Sopenharmony_ci}); 241cb0ef41Sopenharmony_ciassert.throws(() => setDeserializeMainFunction(() => {}), { 251cb0ef41Sopenharmony_ci code: 'ERR_NOT_BUILDING_SNAPSHOT', 261cb0ef41Sopenharmony_ci}); 27