Permalink
Browse files

Refuse to handle exclusive slices in

  • Loading branch information...
jamesdabbs committed Apr 11, 2013
1 parent 6fc5628 commit 33066671d49d3ef46c6cd4e6c17d4ede8848b90c
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/steffi/vector.rb
  2. +4 −0 spec/steffi/vector_spec.rb
View
@@ -27,7 +27,7 @@ def self.from_a ary
end
def self.from_slice slice
- # FIXME: this only works for inclusive slices
+ raise "Slices should be inclusive" if slice.exclude_end?
new { |v| Igraph.vector_init_seq v.pointer, slice.first, slice.last }
end
@@ -9,6 +9,10 @@
Steffi::Vector.from_slice(5..9).should have(5).members
end
+ it 'errors on exclusive slices' do
+ expect { Steffi::Vector.from_slice(5...9) }.to raise_error
+ end
+
# -----
subject { Steffi::Vector.from_a [2, 3, 4] }

0 comments on commit 3306667

Please sign in to comment.