11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_cirequire('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst { kMaxLength, kStringMaxLength } = require('buffer'); 61cb0ef41Sopenharmony_ciconst { MAX_LENGTH, MAX_STRING_LENGTH } = require('buffer').constants; 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciassert.strictEqual(typeof MAX_LENGTH, 'number'); 91cb0ef41Sopenharmony_ciassert.strictEqual(typeof MAX_STRING_LENGTH, 'number'); 101cb0ef41Sopenharmony_ciassert(MAX_STRING_LENGTH <= MAX_LENGTH); 111cb0ef41Sopenharmony_ciassert.throws(() => ' '.repeat(MAX_STRING_LENGTH + 1), 121cb0ef41Sopenharmony_ci /^RangeError: Invalid string length$/); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ci' '.repeat(MAX_STRING_LENGTH); // Should not throw. 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci// Legacy values match: 171cb0ef41Sopenharmony_ciassert.strictEqual(kMaxLength, MAX_LENGTH); 181cb0ef41Sopenharmony_ciassert.strictEqual(kStringMaxLength, MAX_STRING_LENGTH); 19