Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

No check-marks and X in a bats script test run O/P #127

Open
vkhetrapal opened this issue Oct 15, 2015 · 5 comments
Open

No check-marks and X in a bats script test run O/P #127

vkhetrapal opened this issue Oct 15, 2015 · 5 comments

Comments

@vkhetrapal
Copy link

I have created below script for testing installation of git.

!/usr/bin/env bats

@test "verify git installation" {
run bash -c "rpm -qa|grep git"
[ "$status" -eq 0 ]
}

@test "Verifying whether git binary is available" {
run which git
[ "$status" -eq 0 ]

Due to some reason, my "kitchen verify" produces weird O/P. Am I doing something wrong ?
I am using docker (centos7 -- base image) as kitchen driver.

kitchen verify

-----> Starting Kitchen (v1.4.2)
-----> Verifying ...
$$$$$$ Running legacy verify for 'Docker' Driver
Preparing files for transfer
Removing /tmp/verifier/suites/bats
Transferring files to
-----> Running bats test suite
verify git installation1/2 ✓ verify git installation
✓ Verifying whether git binary is available

   2 tests, 0 failures
   Finished verifying <git-centos> (0m0.90s).

-----> Kitchen is finished. (0m0.98s)

@vkhetrapal
Copy link
Author

These lines are the issue :

verify git installation1/2 ✓ verify git installation
✓ Verifying whether git binary is available

@X1011
Copy link

X1011 commented Oct 22, 2015

Somewhere along the way, the UTF-8-encoded ✓ is incorrectly being interpreted with Windows-1252 encoding. You will have to narrow down where. You could start by opening libexec/bats-format-tap-stream in a text editor to see if it's encoded correctly on-disk. If so, I'd guess your terminal does not support UTF-8.

@leahcim
Copy link

leahcim commented Oct 24, 2015

It could also be your font not having the characters in question. Take a look at libexec/bats-format-tap-stream in #128. You might e.g. view it like this:

head -46 libexec/bats-format-tap-stream | tail -7

This should show you:

if [[ $OSTYPE != *msys* ]]; then
  PASS_SYMBOL=''
  FAIL_SYMBOL=''
else
  PASS_SYMBOL=''
  FAIL_SYMBOL='×'
fi

Can you see any of the characters correctly in your terminal?

@vkhetrapal
Copy link
Author

I am actually using busser-bats gem and a look at /root/.chefdk/gem/ruby/2.1.0/gems/busser-bats-0.3.0/vendor/bats/libexec/bats-format-tap-stream shows this :

pass() {
go_to_column 0
printf " ✓ %s" "$name"
advance

fail() {
go_to_column 0
set_color 1 bold
printf " ✗ %s" "$name"
advance

@X1011
Copy link

X1011 commented Oct 29, 2015

maybe you need to change your system locale to UTF-8: https://google.com/search?q=CentOS+utf-8

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants