summaryrefslogtreecommitdiff
path: root/spec/rubyspec/core/string/element_reference_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubyspec/core/string/element_reference_spec.rb')
-rw-r--r--spec/rubyspec/core/string/element_reference_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/rubyspec/core/string/element_reference_spec.rb b/spec/rubyspec/core/string/element_reference_spec.rb
new file mode 100644
index 0000000000..785bbdaf80
--- /dev/null
+++ b/spec/rubyspec/core/string/element_reference_spec.rb
@@ -0,0 +1,35 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+require File.expand_path('../fixtures/classes.rb', __FILE__)
+require File.expand_path('../shared/slice.rb', __FILE__)
+
+describe "String#[]" do
+ it_behaves_like :string_slice, :[]
+end
+
+describe "String#[] with index, length" do
+ it_behaves_like :string_slice_index_length, :[]
+end
+
+describe "String#[] with Range" do
+ it_behaves_like :string_slice_range, :[]
+end
+
+describe "String#[] with Regexp" do
+ it_behaves_like :string_slice_regexp, :[]
+end
+
+describe "String#[] with Regexp, index" do
+ it_behaves_like :string_slice_regexp_index, :[]
+end
+
+describe "String#[] with Regexp, group" do
+ it_behaves_like :string_slice_regexp_group, :[]
+end
+
+describe "String#[] with String" do
+ it_behaves_like :string_slice_string, :[]
+end
+
+describe "String#[] with Symbol" do
+ it_behaves_like :string_slice_symbol, :[]
+end