Skip to content

Commit c50e4f9

Browse files
richardlautargos
authored andcommitted
test: test for minimum ICU version consistency
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]>
1 parent 2acf653 commit c50e4f9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
3+
// Tests that the minimum ICU version for Node.js is at least the minimum ICU
4+
// version for V8.
5+
6+
require('../common');
7+
const assert = require('assert');
8+
const path = require('path');
9+
const { readFileSync } = require('fs');
10+
11+
const srcRoot = path.join(__dirname, '..', '..');
12+
const icuVersionsFile = path.join(srcRoot, 'tools', 'icu', 'icu_versions.json');
13+
const { minimum_icu: minimumICU } = require(icuVersionsFile);
14+
const v8SrcFile = path.join(srcRoot,
15+
'deps', 'v8', 'src', 'objects', 'intl-objects.h');
16+
const v8Src = readFileSync(v8SrcFile, { encoding: 'utf8' });
17+
const v8MinimumICU = v8Src.match(/#define\s+V8_MINIMUM_ICU_VERSION\s+(\d+)/)[1];
18+
assert.ok(minimumICU >= Number(v8MinimumICU),
19+
`minimum ICU version in ${icuVersionsFile} (${minimumICU}) ` +
20+
`must be at least that in ${v8SrcFile} (${Number(v8MinimumICU)})`);

0 commit comments

Comments
 (0)