1// Flags: --expose-internals 2'use strict'; 3require('../common'); 4const assert = require('assert'); 5const { versionCheck } = require('internal/v8_prof_polyfill'); 6 7assert.strictEqual(versionCheck('v8-version,1,2,3,4,0', '1.2.3'), undefined); 8assert.strictEqual(versionCheck('v8-version,1,2,3,4,0', '1.2.3.3'), undefined); 9assert.strictEqual(versionCheck('v8-version,1,2,3,4,0', '1.2.3.4'), undefined); 10assert.strictEqual(versionCheck('v8-version,1,2,3,4,0', '1.2.3.5'), undefined); 11assert.strictEqual(versionCheck('v8-version,1,2,3,4,-node.1,0', '1.2.3'), 12 undefined); 13assert.strictEqual(versionCheck('v8-version,1,2,3,4,-node.1,0', '1.2.3.4'), 14 undefined); 15assert.strictEqual(versionCheck('v8-version,1,2,3,4,-node.1,0', '1.2.3-node.1'), 16 undefined); 17assert.strictEqual(versionCheck('v8-version,1,2,3,4,-node.1,0', '1.2.3-node.2'), 18 undefined); 19assert.strictEqual( 20 versionCheck('v8-version,1,2,3,4,-node.1,0', '1.2.3.4-node.2'), 21 undefined); 22 23{ 24 const expected = 'Unable to read v8-version from log file.'; 25 assert.strictEqual(versionCheck('faux', '1.2.3'), expected); 26 assert.strictEqual(versionCheck('v8-version', '1.2.3'), expected); 27 assert.strictEqual(versionCheck('v8-version,1', '1.2.3'), expected); 28 assert.strictEqual(versionCheck('v8-version,1,2', '1.2.3'), expected); 29 assert.strictEqual(versionCheck('v8-version,1,2,3', '1.2.3'), expected); 30 assert.strictEqual(versionCheck('v8-version,1,2,3,4', '1.2.3'), expected); 31 assert.strictEqual(versionCheck('v8-version,1,2,3,4,5,6,7', '1.2.3'), 32 expected); 33} 34 35{ 36 const expected = 'Testing v8 version different from logging version'; 37 assert.strictEqual(versionCheck('v8-version,4,3,2,1,0', '1.2.3'), expected); 38 assert.strictEqual(versionCheck('v8-version,4,3,2,1,0', '1.2.3.4'), expected); 39 assert.strictEqual(versionCheck('v8-version,4,3,2,1,0', '4.3.1.1'), expected); 40 assert.strictEqual(versionCheck('v8-version,4,3,2,1,0', '4.3.3.1'), expected); 41} 42