formatador
formatador copied to clipboard
Fromatador 0.3.0+ breaks Guard test suite.
I observe following test suite errors in Guard:
$ rspec -rspec_helper -f d spec/lib/guard/dsl_describer_spec.rb
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 38332
Guard::DslDescriber
#list
lists the available Guards declared as strings or symbols (FAILED - 1)
.notifiers
properly connects and disconnects
shows the notifiers and their options (FAILED - 2)
.show
shows the Guards and their options
Failures:
1) Guard::DslDescriber#list lists the available Guards declared as strings or symbols
Failure/Error: expect(@output).to eq result
expected: " +---------+-----------+\n | Plugin | Guardfile |\n +---------+-----------+\n | Another | ✔ ... | ✘ |\n | More | ✘ |\n | Test | ✔ |\n +---------+-----------+\n"
got: " +---------+-----------+\n | Plugin | Guardfile |\n +---------+-----------+\n | Another | ✔ ...en | ✘ |\n | More | ✘ |\n | Test | ✔ |\n +---------+-----------+\n"
(compared using ==)
Diff:
@@ -1,9 +1,9 @@
+---------+-----------+
| Plugin | Guardfile |
+---------+-----------+
- | Another | ✔ |
- | Even | ✘ |
- | More | ✘ |
- | Test | ✔ |
+ | Another | ✔ |
+ | Even | ✘ |
+ | More | ✘ |
+ | Test | ✔ |
+---------+-----------+
# ./spec/lib/guard/dsl_describer_spec.rb:75:in `block (3 levels) in <top (required)>'
2) Guard::DslDescriber.notifiers shows the notifiers and their options
Failure/Error: expect(@output).to eq result
expected: " +----------------+-----------+------+--------+-------+\n | Name | Available | Used | Op...e | ✘ | ✘ | | |\n +----------------+-----------+------+--------+-------+\n"
got: " +----------------+-----------+------+--------+-------+\n | Name | Available | Used | Op...tle | ✘ | ✘ | | |\n +----------------+-----------+------+--------+-------+\n"
(compared using ==)
Diff:
@@ -1,8 +1,8 @@
+----------------+-----------+------+--------+-------+
| Name | Available | Used | Option | Value |
+----------------+-----------+------+--------+-------+
- | gntp | ✔ | ✔ | sticky | true |
+ | gntp | ✔ | ✔ | sticky | true |
+----------------+-----------+------+--------+-------+
- | terminal_title | ✘ | ✘ | | |
+ | terminal_title | ✘ | ✘ | | |
+----------------+-----------+------+--------+-------+
# ./spec/lib/guard/dsl_describer_spec.rb:163:in `block (3 levels) in <top (required)>'
Finished in 0.04458 seconds (files took 0.10428 seconds to load)
4 examples, 2 failures
Failed examples:
rspec ./spec/lib/guard/dsl_describer_spec.rb:73 # Guard::DslDescriber#list lists the available Guards declared as strings or symbols
rspec ./spec/lib/guard/dsl_describer_spec.rb:161 # Guard::DslDescriber.notifiers shows the notifiers and their options
Randomized with seed 38332
And I'd blame #32 for this, because it makes and assumption that every displayed unicode character occupies two single byte columns. But that is not universal true, as can be seen from this test case leveraging the unicode gem:
$ ruby -runicode -e 'p Unicode.width("✔")'
1
$ ruby -runicode -e 'p Unicode.width("震度")'
4
Me not being Japanese, I'd propose to revert #32, but yeah, not sure how to make everybody happy:
$ ruby -runicode -e 'p Unicode.width("🤷")'
1