summaryrefslogtreecommitdiff
path: root/spec/ruby/fixtures
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/fixtures')
-rw-r--r--spec/ruby/fixtures/class.rb4
-rw-r--r--spec/ruby/fixtures/code/a/load_fixture.dylib1
-rw-r--r--spec/ruby/fixtures/code/c/load_fixture.rb1
-rw-r--r--spec/ruby/fixtures/code/concurrent_require_fixture.rb4
-rw-r--r--spec/ruby/fixtures/code/d/load_fixture.rb.rb1
-rw-r--r--spec/ruby/fixtures/code/load_fixture.dylib1
-rw-r--r--spec/ruby/fixtures/code/load_fixture.ext.dylib1
-rw-r--r--spec/ruby/fixtures/code/load_wrap_fixture.rb (renamed from spec/ruby/fixtures/code/wrap_fixture.rb)3
-rw-r--r--spec/ruby/fixtures/constants.rb26
-rw-r--r--spec/ruby/fixtures/enumerator/classes.rb15
-rw-r--r--spec/ruby/fixtures/io.rb12
-rw-r--r--spec/ruby/fixtures/math/common.rb3
-rw-r--r--spec/ruby/fixtures/rational.rb14
13 files changed, 52 insertions, 34 deletions
diff --git a/spec/ruby/fixtures/class.rb b/spec/ruby/fixtures/class.rb
index 68fbca7ba7..98cb6c82a2 100644
--- a/spec/ruby/fixtures/class.rb
+++ b/spec/ruby/fixtures/class.rb
@@ -122,6 +122,10 @@ module ClassSpecs
end
end
end
+
+ DEFINE_CLASS = -> do
+ class ::A; end
+ end
end
class Class
diff --git a/spec/ruby/fixtures/code/a/load_fixture.dylib b/spec/ruby/fixtures/code/a/load_fixture.dylib
new file mode 100644
index 0000000000..31f4b1a7bb
--- /dev/null
+++ b/spec/ruby/fixtures/code/a/load_fixture.dylib
@@ -0,0 +1 @@
+ScratchPad << :ext_dylib
diff --git a/spec/ruby/fixtures/code/c/load_fixture.rb b/spec/ruby/fixtures/code/c/load_fixture.rb
new file mode 100644
index 0000000000..4a6e9c9601
--- /dev/null
+++ b/spec/ruby/fixtures/code/c/load_fixture.rb
@@ -0,0 +1 @@
+ScratchPad << :loaded
diff --git a/spec/ruby/fixtures/code/concurrent_require_fixture.rb b/spec/ruby/fixtures/code/concurrent_require_fixture.rb
new file mode 100644
index 0000000000..d4ce734183
--- /dev/null
+++ b/spec/ruby/fixtures/code/concurrent_require_fixture.rb
@@ -0,0 +1,4 @@
+object = ScratchPad.recorded
+thread = Thread.new { object.require(__FILE__) }
+Thread.pass until thread.stop?
+ScratchPad.record(thread)
diff --git a/spec/ruby/fixtures/code/d/load_fixture.rb.rb b/spec/ruby/fixtures/code/d/load_fixture.rb.rb
new file mode 100644
index 0000000000..7e9217729a
--- /dev/null
+++ b/spec/ruby/fixtures/code/d/load_fixture.rb.rb
@@ -0,0 +1 @@
+ScratchPad << :rbrb
diff --git a/spec/ruby/fixtures/code/load_fixture.dylib b/spec/ruby/fixtures/code/load_fixture.dylib
new file mode 100644
index 0000000000..31f4b1a7bb
--- /dev/null
+++ b/spec/ruby/fixtures/code/load_fixture.dylib
@@ -0,0 +1 @@
+ScratchPad << :ext_dylib
diff --git a/spec/ruby/fixtures/code/load_fixture.ext.dylib b/spec/ruby/fixtures/code/load_fixture.ext.dylib
new file mode 100644
index 0000000000..31f4b1a7bb
--- /dev/null
+++ b/spec/ruby/fixtures/code/load_fixture.ext.dylib
@@ -0,0 +1 @@
+ScratchPad << :ext_dylib
diff --git a/spec/ruby/fixtures/code/wrap_fixture.rb b/spec/ruby/fixtures/code/load_wrap_fixture.rb
index 7ddf5a62e0..526bbf8c82 100644
--- a/spec/ruby/fixtures/code/wrap_fixture.rb
+++ b/spec/ruby/fixtures/code/load_wrap_fixture.rb
@@ -2,7 +2,10 @@ class LoadSpecWrap
ScratchPad << String
end
+LOAD_WRAP_SPECS_TOP_LEVEL_CONSTANT = 1
+
def load_wrap_specs_top_level_method
+ :load_wrap_specs_top_level_method
end
ScratchPad << method(:load_wrap_specs_top_level_method).owner
diff --git a/spec/ruby/fixtures/constants.rb b/spec/ruby/fixtures/constants.rb
index 37271ddcc8..7f0b88daab 100644
--- a/spec/ruby/fixtures/constants.rb
+++ b/spec/ruby/fixtures/constants.rb
@@ -10,7 +10,7 @@
# variety in class and module configurations, including hierarchy,
# containment, inclusion, singletons and toplevel.
#
-# Constants are numbered for for uniqueness. The CS_ prefix is uniformly used
+# Constants are numbered for uniqueness. The CS_ prefix is uniformly used
# and is to minimize clashes with other toplevel constants (see e.g. ModuleA
# which is included in Object). Constant values are symbols. A numbered suffix
# is used to distinguish constants with the same name defined in different
@@ -44,6 +44,7 @@ module ConstantSpecs
# Included in ParentA
module ModuleB
+ LINE = __LINE__ - 1
CS_CONST10 = :const10_9
CS_CONST11 = :const11_2
CS_CONST12 = :const12_1
@@ -75,12 +76,19 @@ module ConstantSpecs
CS_CONST10 = :const10_8
end
+ # Included in ContainerA
+ module ModuleIncludePrepended
+ prepend ModuleD
+
+ CS_CONST11 = :const11_8
+ end
+
# The following classes/modules have all the constants set "statically".
# Contrast with the classes below where the constants are set as the specs
# are run.
class ClassA
- CS_CLASS_A_LINE = __LINE__ - 1
+ LINE = __LINE__ - 1
CS_CONST10 = :const10_10
CS_CONST10_LINE = __LINE__ - 1
CS_CONST16 = :const16
@@ -169,6 +177,10 @@ module ConstantSpecs
def const10; CS_CONST10; end
end
+ class ContainerPrepend
+ include ModuleIncludePrepended
+ end
+
class ContainerA::ChildA
def self.const23; CS_CONST23; end
end
@@ -299,4 +311,14 @@ module ConstantSpecs
private_constant :CS_PRIVATE
end
+module ConstantSpecsThree
+ module ConstantSpecsTwo
+ Foo = :cs_three_foo
+ end
+end
+
+module ConstantSpecsTwo
+ Foo = :cs_two_foo
+end
+
include ConstantSpecs::ModuleA
diff --git a/spec/ruby/fixtures/enumerator/classes.rb b/spec/ruby/fixtures/enumerator/classes.rb
deleted file mode 100644
index 6f285b8efa..0000000000
--- a/spec/ruby/fixtures/enumerator/classes.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-module EnumSpecs
- class Numerous
-
- include Enumerable
-
- def initialize(*list)
- @list = list.empty? ? [2, 5, 3, 6, 1, 4] : list
- end
-
- def each
- @list.each { |i| yield i }
- end
- end
-
-end
diff --git a/spec/ruby/fixtures/io.rb b/spec/ruby/fixtures/io.rb
new file mode 100644
index 0000000000..87ebbbb2bd
--- /dev/null
+++ b/spec/ruby/fixtures/io.rb
@@ -0,0 +1,12 @@
+module IOSpec
+ def self.exhaust_write_buffer(io)
+ written = 0
+ buf = " " * 4096
+
+ while true
+ written += io.write_nonblock(buf)
+ end
+ rescue Errno::EAGAIN, Errno::EWOULDBLOCK
+ written
+ end
+end
diff --git a/spec/ruby/fixtures/math/common.rb b/spec/ruby/fixtures/math/common.rb
deleted file mode 100644
index 024732fa7a..0000000000
--- a/spec/ruby/fixtures/math/common.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class IncludesMath
- include Math
-end
diff --git a/spec/ruby/fixtures/rational.rb b/spec/ruby/fixtures/rational.rb
deleted file mode 100644
index 844d7f9820..0000000000
--- a/spec/ruby/fixtures/rational.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module RationalSpecs
- class SubNumeric < Numeric
- def initialize(value)
- @value = Rational(value)
- end
-
- def to_r
- @value
- end
- end
-
- class CoerceError < StandardError
- end
-end