Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | // Copyright 2013 Mozilla Corporation. All rights reserved. |
michael@0 | 2 | // This code is governed by the BSD license found in the LICENSE file. |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * @description Tests that the options minimumSignificantDigits and |
michael@0 | 6 | * maximumSignificantDigits are read in the right sequence. |
michael@0 | 7 | * @author Norbert Lindenberg |
michael@0 | 8 | */ |
michael@0 | 9 | |
michael@0 | 10 | var read = 0; |
michael@0 | 11 | |
michael@0 | 12 | function readMinimumSignificantDigits() { |
michael@0 | 13 | ++read; |
michael@0 | 14 | if (read === 1) { |
michael@0 | 15 | return 0; // invalid value, but on first read that's OK |
michael@0 | 16 | } else if (read === 3) { |
michael@0 | 17 | return 1; // valid value |
michael@0 | 18 | } else { |
michael@0 | 19 | $ERROR("minimumSignificantDigits read out of sequence: " + read + "."); |
michael@0 | 20 | } |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | function readMaximumSignificantDigits() { |
michael@0 | 24 | ++read; |
michael@0 | 25 | if (read === 2) { |
michael@0 | 26 | return 0; // invalid value, but on first read that's OK |
michael@0 | 27 | } else if (read === 4) { |
michael@0 | 28 | return 1; // valid value |
michael@0 | 29 | } else { |
michael@0 | 30 | $ERROR("maximumSignificantDigits read out of sequence: " + read + "."); |
michael@0 | 31 | } |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | var options = {}; |
michael@0 | 35 | Object.defineProperty(options, "minimumSignificantDigits", |
michael@0 | 36 | { get: readMinimumSignificantDigits }); |
michael@0 | 37 | Object.defineProperty(options, "maximumSignificantDigits", |
michael@0 | 38 | { get: readMaximumSignificantDigits }); |
michael@0 | 39 | |
michael@0 | 40 | new Intl.NumberFormat("de", options); |
michael@0 | 41 | |
michael@0 | 42 | if (read !== 4) { |
michael@0 | 43 | $ERROR("insuffient number of property reads: " + read + "."); |
michael@0 | 44 | } |