Skip to content

Commit

Permalink
test: test for minimum ICU version consistency
Browse files Browse the repository at this point in the history
The minimum ICU version for Node.js must be at least the minimum ICU
version for V8.

PR-URL: #30608
Refs: #30607
Reviewed-By: Steven R Loomis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
richardlau authored and MylesBorins committed Dec 17, 2019
1 parent a493feb commit 1c9ba2c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/parallel/test-icu-minimum-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

// Tests that the minimum ICU version for Node.js is at least the minimum ICU
// version for V8.

require('../common');
const assert = require('assert');
const path = require('path');
const { readFileSync } = require('fs');

const srcRoot = path.join(__dirname, '..', '..');
const icuVersionsFile = path.join(srcRoot, 'tools', 'icu', 'icu_versions.json');
const { minimum_icu: minimumICU } = require(icuVersionsFile);
const v8SrcFile = path.join(srcRoot,
'deps', 'v8', 'src', 'objects', 'intl-objects.h');
const v8Src = readFileSync(v8SrcFile, { encoding: 'utf8' });
const v8MinimumICU = v8Src.match(/#define\s+V8_MINIMUM_ICU_VERSION\s+(\d+)/)[1];
assert.ok(minimumICU >= Number(v8MinimumICU),
`minimum ICU version in ${icuVersionsFile} (${minimumICU}) ` +
`must be at least that in ${v8SrcFile} (${Number(v8MinimumICU)})`);

0 comments on commit 1c9ba2c

Please sign in to comment.