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

Spec fails in Colorize if stdout is not TTY #8609

Closed
lugia-kun opened this issue Dec 22, 2019 · 2 comments
Closed

Spec fails in Colorize if stdout is not TTY #8609

lugia-kun opened this issue Dec 22, 2019 · 2 comments
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc.

Comments

@lugia-kun
Copy link

lugia-kun commented Dec 22, 2019

Following two spec fails if standard output is not TTY (redirected):

$ CC="gcc -fuse-ld=gold" bin/crystal spec spec/std_spec.cr >spec.log
$ cat spec.log
(omit)

Failures:

  1) colorize colorizes with surround
     Failure/Error: io.to_s.should eq("\e[31mhello\e[0;32mworld\e[0;31mbye\e[0m")

       Expected: "\e[31mhello\e[0;32mworld\e[0;31mbye\e[0m"
            got: "\e[31mhelloworldbye\e[0m"

     # spec/std/colorize_spec.cr:141

  2) colorize colorizes with to_s
     Failure/Error: ColorizeToS.new.colorize.red.to_s.should eq("\e[31mhello\e[0;34mworld\e[0;31mbye\e[0m")

       Expected: "\e[31mhello\e[0;34mworld\e[0;31mbye\e[0m"
            got: "helloworldbye"

     # spec/std/colorize_spec.cr:181

crystal version

$ bin/crystal version
Using compiled compiler at .build/crystal
Crystal 0.33.0-dev [5704b9e6c] (2019-12-22)

LLVM: 9.0.0
Default target: x86_64-unknown-linux-gnu
@RX14 RX14 added the kind:bug A bug in the code. Does not apply to documentation, specs, etc. label Dec 22, 2019
@asterite
Copy link
Member

I can't reproduce this on master.

@RX14
Copy link
Contributor

RX14 commented Feb 11, 2020

Fixed by #8673

@RX14 RX14 closed this as completed Feb 11, 2020
infinisil added a commit to infinisil/nixpkgs that referenced this issue Feb 17, 2020
It seems that there might be hydra machines that run an older version of Nix
where NixOS/nix#2878 is not yet included
(unconfirmed)

In addition crystal 0.32.1 has a bug that only occurs when there is no
tty: crystal-lang/crystal#8609

Combining this lead to a crystal build failing: https://hydra.nixos.org/build/113074265

This fixes that probably rather uncommon occurence by applying the
upstream fix for the bug: crystal-lang/crystal#8609
infinisil added a commit to infinisil/nixpkgs that referenced this issue Feb 18, 2020
It seems that there might be hydra machines that run an older version of Nix
where NixOS/nix#2878 is not yet included
(unconfirmed)

In addition crystal 0.32.1 has a bug that only occurs when there is no
tty: crystal-lang/crystal#8609

Combining this lead to a crystal build failing: https://hydra.nixos.org/build/113074265

This fixes that probably rather uncommon occurence by applying the
upstream fix for the bug: crystal-lang/crystal#8609
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc.
Projects
None yet
Development

No branches or pull requests

3 participants