diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-27 14:25:00 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-27 14:25:00 +0000 |
commit | 8180b5bfc0fe4d4b91b590de9110687294552a8f (patch) | |
tree | fb6b2270b710d2a8390a1cb0d0bb76b9cbc1c6ad /spec/ruby/command_line/dash_encoding_spec.rb | |
parent | a6413848153e6c37f6b0fea64e3e871460732e34 (diff) |
Update to ruby/spec@09fa86c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/command_line/dash_encoding_spec.rb')
-rw-r--r-- | spec/ruby/command_line/dash_encoding_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/ruby/command_line/dash_encoding_spec.rb b/spec/ruby/command_line/dash_encoding_spec.rb new file mode 100644 index 0000000000..e7889b4def --- /dev/null +++ b/spec/ruby/command_line/dash_encoding_spec.rb @@ -0,0 +1,33 @@ +require_relative '../spec_helper' + +describe 'The --encoding command line option' do + before :each do + @test_string = "print [Encoding.default_external.name, Encoding.default_internal&.name].inspect" + end + + describe 'sets Encoding.default_external and optionally Encoding.default_internal' do + it "if given a single encoding with an =" do + ruby_exe(@test_string, options: '--disable-gems --encoding=big5').should == [Encoding::Big5.name, nil].inspect + end + + it "if given a single encoding as a separate argument" do + ruby_exe(@test_string, options: '--disable-gems --encoding big5').should == [Encoding::Big5.name, nil].inspect + end + + it "if given two encodings with an =" do + ruby_exe(@test_string, options: '--disable-gems --encoding=big5:utf-32be').should == [Encoding::Big5.name, Encoding::UTF_32BE.name].inspect + end + + it "if given two encodings as a separate argument" do + ruby_exe(@test_string, options: '--disable-gems --encoding big5:utf-32be').should == [Encoding::Big5.name, Encoding::UTF_32BE.name].inspect + end + + it "if given two encodings as a separate argument" do + ruby_exe(@test_string, options: '--disable-gems --encoding big5:utf-32be').should == [Encoding::Big5.name, Encoding::UTF_32BE.name].inspect + end + end + + it "does not accept a third encoding" do + ruby_exe(@test_string, options: '--disable-gems --encoding big5:utf-32be:utf-32le', args: '2>&1').should =~ /extra argument for --encoding: utf-32le/ + end +end |