summaryrefslogtreecommitdiff
path: root/spec/ruby/library/weakref
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-03 16:19:40 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-03 16:19:40 +0000
commitb53cf149ad8d7c46572e4567ca949b4f82ebb22c (patch)
treeee5032bcb38573dade8ba2c46acbcc0d5f3ddfe3 /spec/ruby/library/weakref
parentaeeaadaad08038217440c1e9e7c5ca126d7dc633 (diff)
Update to ruby/spec@9be7c7e
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/library/weakref')
-rw-r--r--spec/ruby/library/weakref/allocate_spec.rb8
-rw-r--r--spec/ruby/library/weakref/new_spec.rb13
2 files changed, 21 insertions, 0 deletions
diff --git a/spec/ruby/library/weakref/allocate_spec.rb b/spec/ruby/library/weakref/allocate_spec.rb
new file mode 100644
index 0000000000..76e81c4e5e
--- /dev/null
+++ b/spec/ruby/library/weakref/allocate_spec.rb
@@ -0,0 +1,8 @@
+require_relative '../../spec_helper'
+require 'weakref'
+
+describe "WeakRef#allocate" do
+ it "assigns nil as the reference" do
+ lambda { WeakRef.allocate.__getobj__ }.should raise_error(WeakRef::RefError)
+ end
+end
diff --git a/spec/ruby/library/weakref/new_spec.rb b/spec/ruby/library/weakref/new_spec.rb
new file mode 100644
index 0000000000..6290e61fe3
--- /dev/null
+++ b/spec/ruby/library/weakref/new_spec.rb
@@ -0,0 +1,13 @@
+require_relative '../../spec_helper'
+require 'weakref'
+
+describe "WeakRef#new" do
+ it "creates a subclass correctly" do
+ wr2 = Class.new(WeakRef) {
+ def __getobj__
+ :dummy
+ end
+ }
+ wr2.new(Object.new).__getobj__.should == :dummy
+ end
+end