test/test_format.rb in numerals-0.1.0 vs test/test_format.rb in numerals-0.2.0

- old
+ new

@@ -119,6 +119,53 @@ f2 = f[symbols: { nan: 'Not a Number' }] assert_equal 'Not a Number', f2.symbols.nan assert_equal 'PLUS', f2.symbols.plus end + def test_repeat_aspect + s = Format::Symbols[] + assert_equal '<', s.repeat_begin + assert_equal '>', s.repeat_end + assert_equal '...', s.repeat_suffix + refute s.repeat_delimited + assert_equal 3, s.repeat_count + assert s.repeating + + s.set_repeat! false + refute s.repeating + + s.set_repeat! true, delimiters: '[', count: 2, suffix: '****' + assert_equal '[', s.repeat_begin + assert_nil s.repeat_end + assert_equal '****', s.repeat_suffix + refute s.repeat_delimited + assert_equal 2, s.repeat_count + assert s.repeating + + s.set_repeat! true, delimiters: ['>', '<'], delimited: true + assert_equal '>', s.repeat_begin + assert_equal '<', s.repeat_end + assert s.repeat_delimited + end + + def test_padding_aspect + f = Format[] + refute f.padded? + assert_equal :right, f.padding.adjust + f = f[padding:[10, ' ', :left]] + assert f.padded? + assert_equal :left, f.padding.adjust + assert_equal ' ', f.padding.fill + end + + def tst_grouping + f = Format[] + refute f.grouping? + f.set_grouping! :thousands + assert f.grouping? + assert_equal [3], f.grouping + f.set_grouping! false + refute f.grouping? + assert_equal [], f.grouping + end + end