• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
6require('../common');
7const assert = require('assert');
8const path = require('path');
9const { readFileSync } = require('fs');
10
11const srcRoot = path.join(__dirname, '..', '..');
12const icuVersionsFile = path.join(srcRoot, 'tools', 'icu', 'icu_versions.json');
13const { minimum_icu: minimumICU } = require(icuVersionsFile);
14const v8SrcFile = path.join(srcRoot,
15                            'deps', 'v8', 'src', 'objects', 'intl-objects.h');
16const v8Src = readFileSync(v8SrcFile, { encoding: 'utf8' });
17const v8MinimumICU = v8Src.match(/#define\s+V8_MINIMUM_ICU_VERSION\s+(\d+)/)[1];
18assert.ok(minimumICU >= Number(v8MinimumICU),
19          `minimum ICU version in ${icuVersionsFile} (${minimumICU}) ` +
20          `must be at least that in ${v8SrcFile} (${Number(v8MinimumICU)})`);
21