aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/library
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library')
-rw-r--r--spec/ruby/library/cgi/escapeHTML_spec.rb4
-rw-r--r--spec/ruby/library/stringio/binmode_spec.rb14
-rw-r--r--spec/ruby/library/stringio/inspect_spec.rb19
-rw-r--r--spec/ruby/library/yaml/add_builtin_type_spec.rb2
-rw-r--r--spec/ruby/library/yaml/add_domain_type_spec.rb2
-rw-r--r--spec/ruby/library/yaml/add_private_type_spec.rb2
-rw-r--r--spec/ruby/library/yaml/add_ruby_type_spec.rb2
-rw-r--r--spec/ruby/library/yaml/detect_implicit_spec.rb2
-rw-r--r--spec/ruby/library/yaml/each_node_spec.rb2
-rw-r--r--spec/ruby/library/yaml/emitter_spec.rb2
-rw-r--r--spec/ruby/library/yaml/generic_parser_spec.rb2
-rw-r--r--spec/ruby/library/yaml/object_maker_spec.rb2
-rw-r--r--spec/ruby/library/yaml/parse_documents_spec.rb2
-rw-r--r--spec/ruby/library/yaml/parser_spec.rb2
-rw-r--r--spec/ruby/library/yaml/quick_emit_spec.rb2
-rw-r--r--spec/ruby/library/yaml/read_type_class_spec.rb2
-rw-r--r--spec/ruby/library/yaml/transfer_spec.rb2
-rw-r--r--spec/ruby/library/yaml/try_implicit_spec.rb2
18 files changed, 37 insertions, 30 deletions
diff --git a/spec/ruby/library/cgi/escapeHTML_spec.rb b/spec/ruby/library/cgi/escapeHTML_spec.rb
index dcbfebe720..421aac5d4a 100644
--- a/spec/ruby/library/cgi/escapeHTML_spec.rb
+++ b/spec/ruby/library/cgi/escapeHTML_spec.rb
@@ -6,6 +6,10 @@ describe "CGI.escapeHTML" do
CGI.escapeHTML(%[& < > " ']).should == '&amp; &lt; &gt; &quot; &#39;'
end
+ it "escapes invalid encoding" do
+ CGI.escapeHTML(%[<\xA4??>]).should == "&lt;\xA4??&gt;"
+ end
+
it "does not escape any other characters" do
chars = " !\#$%()*+,-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
CGI.escapeHTML(chars).should == chars
diff --git a/spec/ruby/library/stringio/binmode_spec.rb b/spec/ruby/library/stringio/binmode_spec.rb
index 5d9a8c41df..83178787f3 100644
--- a/spec/ruby/library/stringio/binmode_spec.rb
+++ b/spec/ruby/library/stringio/binmode_spec.rb
@@ -6,4 +6,18 @@ describe "StringIO#binmode" do
io = StringIO.new("example")
io.binmode.should equal(io)
end
+
+ it "changes external encoding to BINARY" do
+ io = StringIO.new
+ io.external_encoding.should == Encoding.find('locale')
+ io.binmode
+ io.external_encoding.should == Encoding::BINARY
+ end
+
+ it "does not set internal encoding" do
+ io = StringIO.new
+ io.internal_encoding.should == nil
+ io.binmode
+ io.internal_encoding.should == nil
+ end
end
diff --git a/spec/ruby/library/stringio/inspect_spec.rb b/spec/ruby/library/stringio/inspect_spec.rb
new file mode 100644
index 0000000000..7c02f8d360
--- /dev/null
+++ b/spec/ruby/library/stringio/inspect_spec.rb
@@ -0,0 +1,19 @@
+require_relative '../../spec_helper'
+require "stringio"
+
+describe "StringIO#inspect" do
+ it "returns the same as #to_s" do
+ io = StringIO.new("example")
+ io.inspect.should == io.to_s
+ end
+
+ it "does not include the contents" do
+ io = StringIO.new("contents")
+ io.inspect.should_not include("contents")
+ end
+
+ it "uses the regular Object#inspect without any instance variable" do
+ io = StringIO.new("example")
+ io.inspect.should =~ /\A#<StringIO:0x\h+>\z/
+ end
+end
diff --git a/spec/ruby/library/yaml/add_builtin_type_spec.rb b/spec/ruby/library/yaml/add_builtin_type_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/add_builtin_type_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/add_domain_type_spec.rb b/spec/ruby/library/yaml/add_domain_type_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/add_domain_type_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/add_private_type_spec.rb b/spec/ruby/library/yaml/add_private_type_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/add_private_type_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/add_ruby_type_spec.rb b/spec/ruby/library/yaml/add_ruby_type_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/add_ruby_type_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/detect_implicit_spec.rb b/spec/ruby/library/yaml/detect_implicit_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/detect_implicit_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/each_node_spec.rb b/spec/ruby/library/yaml/each_node_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/each_node_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/emitter_spec.rb b/spec/ruby/library/yaml/emitter_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/emitter_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/generic_parser_spec.rb b/spec/ruby/library/yaml/generic_parser_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/generic_parser_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/object_maker_spec.rb b/spec/ruby/library/yaml/object_maker_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/object_maker_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/parse_documents_spec.rb b/spec/ruby/library/yaml/parse_documents_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/parse_documents_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/parser_spec.rb b/spec/ruby/library/yaml/parser_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/parser_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/quick_emit_spec.rb b/spec/ruby/library/yaml/quick_emit_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/quick_emit_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/read_type_class_spec.rb b/spec/ruby/library/yaml/read_type_class_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/read_type_class_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/transfer_spec.rb b/spec/ruby/library/yaml/transfer_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/transfer_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
diff --git a/spec/ruby/library/yaml/try_implicit_spec.rb b/spec/ruby/library/yaml/try_implicit_spec.rb
deleted file mode 100644
index 44c820940f..0000000000
--- a/spec/ruby/library/yaml/try_implicit_spec.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'