diff options
author | James Edward Gray II <james@grayproductions.net> | 2015-02-24 10:42:53 -0600 |
---|---|---|
committer | James Edward Gray II <james@grayproductions.net> | 2015-02-24 10:42:53 -0600 |
commit | 80968e9d323ae4b3456eecb5b26346a3acdeea32 (patch) | |
tree | cbc90106719b267c6e8ba0777eee8795da7400c0 | |
parent | afdb90e9fde482a49c471488f42a4ba553a9a58a (diff) | |
parent | 07f3964ee20c2337c97d7ef9c98a1939ef2f541f (diff) | |
download | highline-80968e9d323ae4b3456eecb5b26346a3acdeea32.tar.gz |
Merge pull request #133 from abinoam/issue_129
Make some adjustments on tests so we clear messages on travis
-rw-r--r-- | .travis.yml | 1 | ||||
-rw-r--r-- | Gemfile | 1 | ||||
-rwxr-xr-x | lib/highline.rb | 5 | ||||
-rwxr-xr-x | test/tc_highline.rb | 2 | ||||
-rw-r--r-- | test/tc_menu.rb | 2 | ||||
-rw-r--r-- | test/tc_string_extension.rb | 15 |
6 files changed, 17 insertions, 9 deletions
diff --git a/.travis.yml b/.travis.yml index 81fc916..fc52a58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,3 +14,4 @@ notifications: matrix: allow_failures: - rvm: rbx-2 + - rvm: 1.8.7 @@ -6,4 +6,5 @@ gem "rdoc", :require => false group(:development, :tests) do gem "code_statistics", :require => false gem "test-unit", :require => false + gem "io-console", :platforms => :ruby_18 end diff --git a/lib/highline.rb b/lib/highline.rb index eedd1a8..3d76c8f 100755 --- a/lib/highline.rb +++ b/lib/highline.rb @@ -1,3 +1,4 @@ +# coding: utf-8 # highline.rb # # Created by James Edward Gray II on 2005-04-26. @@ -722,6 +723,10 @@ class HighLine statement = wrap(statement) unless @wrap_at.nil? statement = page_print(statement) unless @page_at.nil? + # 'statement' is encoded in US-ASCII when using ruby 1.9.3(-p551) + # 'indentation' is correctly encoded (same as default_external encoding) + statement = statement.force_encoding(Encoding.default_external) + statement = statement.gsub(/\n(?!$)/,"\n#{indentation}") if @multi_indent statement diff --git a/test/tc_highline.rb b/test/tc_highline.rb index 90865b2..5c91e20 100755 --- a/test/tc_highline.rb +++ b/test/tc_highline.rb @@ -271,7 +271,7 @@ class TestHighLine < Test::Unit::TestCase output = @output.read assert_equal "any input", answer - assert_equal "Prompt: any input\n", output + assert_match "Prompt: any input\n", output @input.close @output.close diff --git a/test/tc_menu.rb b/test/tc_menu.rb index b8133d9..b6e7301 100644 --- a/test/tc_menu.rb +++ b/test/tc_menu.rb @@ -1,4 +1,4 @@ -# encoding: utf-8 +# coding: utf-8 # tc_menu.rb # # Created by Gregory Thomas Brown on 2005-05-10. diff --git a/test/tc_string_extension.rb b/test/tc_string_extension.rb index b1397a7..63770be 100644 --- a/test/tc_string_extension.rb +++ b/test/tc_string_extension.rb @@ -20,13 +20,14 @@ class TestStringExtension < Test::Unit::TestCase def test_Highline_String_is_yaml_serializable require 'yaml' + unless Gem::Version.new(YAML::VERSION) < Gem::Version.new("2.0.2") + highline_string = HighLine::String.new("Yaml didn't messed with HighLine::String") + yaml_highline_string = highline_string.to_yaml + yaml_loaded_string = YAML.load(yaml_highline_string) - highline_string = HighLine::String.new("Yaml didn't messed with HighLine::String") - yaml_highline_string = highline_string.to_yaml - yaml_loaded_string = YAML.load(yaml_highline_string) - - assert_equal "Yaml didn't messed with HighLine::String", yaml_loaded_string - assert_equal highline_string, yaml_loaded_string - assert_instance_of HighLine::String, yaml_loaded_string + assert_equal "Yaml didn't messed with HighLine::String", yaml_loaded_string + assert_equal highline_string, yaml_loaded_string + assert_instance_of HighLine::String, yaml_loaded_string + end end end |