11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci// Tests that the minimum ICU version for Node.js is at least the minimum ICU 41cb0ef41Sopenharmony_ci// version for V8. 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_cirequire('../common'); 71cb0ef41Sopenharmony_ciconst assert = require('assert'); 81cb0ef41Sopenharmony_ciconst path = require('path'); 91cb0ef41Sopenharmony_ciconst { readFileSync } = require('fs'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst srcRoot = path.join(__dirname, '..', '..'); 121cb0ef41Sopenharmony_ciconst icuVersionsFile = path.join(srcRoot, 'tools', 'icu', 'icu_versions.json'); 131cb0ef41Sopenharmony_ciconst { minimum_icu: minimumICU } = require(icuVersionsFile); 141cb0ef41Sopenharmony_ciconst v8SrcFile = path.join(srcRoot, 151cb0ef41Sopenharmony_ci 'deps', 'v8', 'src', 'objects', 'intl-objects.h'); 161cb0ef41Sopenharmony_ciconst v8Src = readFileSync(v8SrcFile, { encoding: 'utf8' }); 171cb0ef41Sopenharmony_ciconst v8MinimumICU = v8Src.match(/#define\s+V8_MINIMUM_ICU_VERSION\s+(\d+)/)[1]; 181cb0ef41Sopenharmony_ciassert.ok(minimumICU >= Number(v8MinimumICU), 191cb0ef41Sopenharmony_ci `minimum ICU version in ${icuVersionsFile} (${minimumICU}) ` + 201cb0ef41Sopenharmony_ci `must be at least that in ${v8SrcFile} (${Number(v8MinimumICU)})`); 21