yard 0.7.0 fails specs on ruby 1.8.7 #317

Closed
graaff opened this Issue May 18, 2011 · 8 comments

Comments

Projects
None yet
3 participants

graaff commented May 18, 2011

Failures:

  1) YARD::Templates::Helpers::HtmlHelper#charset should take file encoding if there is a file
     Failure/Error: charset.should == 'utf-8'
       expected: "utf-8"
            got: "utf8" (using ==)
     # ./spec/templates/helpers/html_helper_spec.rb:40

Obviously just a minor difference in the expected value, not a problem with the code, but would be nice to see fixed.

graaff commented May 18, 2011

I'm also seeing this with ruby enterprise edition and jruby, so it could also be a system-induced thing. I'm using Gentoo Linux here.

Contributor

burtlo commented May 19, 2011

I'll take a look as I still am kicking various flavors of 1.8.7 in every day life.

burtlo was assigned May 19, 2011

Contributor

burtlo commented May 19, 2011

Sadly, I can't reproduce this issue. I tried on my mac with two flavors of ruby enterprise edition (2010.02 and 2011.03). I also tried this on ubuntu with ree (2010.02) and ruby 1.8.7-p302.

This was all with RVM. So I don't know if there is some implied encoding or default encoding that is not present in my environment.

Owner

lsegal commented May 20, 2011

Hey @graaff, what version of ruby are you using? Can you provide the output for ruby -v, and possibly your env as well?

graaff commented May 22, 2011

ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]

I have "LANG=en_US.utf8".

Setting this to LANG="something.else" results in a test failure indicating that my charset is "else", so it looks like this is where the charset comes from.

Looking at the spec code it probably makes most sense to stub the 'LANG' value for the failing spec as well and not depend on whatever people happen to have in their LANG variable.

Owner

lsegal commented May 22, 2011

Yes, we should stub, however stubbing might have missed this potential bug. That said, It doesn't seem that 'utf8' is a valid value for your LANG, so you should probably update your environment. Googling for "lang env utf8" doesn't show anybody using "utf8", but rather "utf-8":

http://www.google.com/search?q=LANG+env+utf8

Loading up irb with your LANG var shows this:

$ export LANG='en_CA.utf8'
$ irb
>> ENV['LANG']
=> "en_CA.utf8"
>> Encoding.default_external
=> #<Encoding:US-ASCII>
>> exit
$ export LANG='en_CA.utf-8'
$ irb
>> Encoding.default_external
=> #<Encoding:UTF-8>
>> 

Basically this isn't a bug in yard, just an issue with our test environment. That's a good thing! But yes, let's stub this value so it doesn't fail for other environments. Just make sure to update your environment to use the valid 'utf-8' value :-)

lsegal closed this in a061eea May 22, 2011

graaff commented May 22, 2011

Thanks for fixing. FWIW, LANG="en_US.utf8" is perfectly valid on my system. It is reported by glibc's "locale -a" as one of the valid values, and ruby 1.9's Encoding.default_external tells met UTF-8. Not sure how widespread this really is.

Owner

lsegal commented May 22, 2011

Hmm... that is an issue then, we need to support that encoding value.

@lsegal lsegal added a commit that referenced this issue May 22, 2011

@lsegal lsegal Handles the valid 'utf8' locale value as 'utf-8'
Supporting #317
48d5ce2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment