node/test/parallel/test-v8-version-tag.js
Rich Trott 245ec6f5ab doc,test: update v8 method doc and comment
Update documentation and test comment for v8.cachedDataVersionTag().

PR-URL: https://github.com/nodejs/node/pull/35795
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-10-27 06:18:26 -07:00

20 lines
711 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const v8 = require('v8');
const versionTag1 = v8.cachedDataVersionTag();
assert.strictEqual(typeof versionTag1, 'number');
assert.strictEqual(v8.cachedDataVersionTag(), versionTag1);
// The value returned by v8.cachedDataVersionTag() is derived from the V8
// version, command-line flags, and detected CPU features. Test that the value
// does indeed update when flags are toggled.
v8.setFlagsFromString('--allow_natives_syntax');
const versionTag2 = v8.cachedDataVersionTag();
assert.strictEqual(typeof versionTag2, 'number');
assert.strictEqual(v8.cachedDataVersionTag(), versionTag2);
assert.notStrictEqual(versionTag1, versionTag2);