Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fromatador 0.3.0+ breaks Guard test suite. #56

Open
voxik opened this issue Sep 2, 2024 · 0 comments
Open

Fromatador 0.3.0+ breaks Guard test suite. #56

voxik opened this issue Sep 2, 2024 · 0 comments

Comments

@voxik
Copy link

voxik commented Sep 2, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant