Skip to content

Commit 052d70b

Browse files
committed
1 parent d41e9fe commit 052d70b

File tree

148 files changed

+1600
-456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+1600
-456
lines changed

spec/ruby/.mspec.constants

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
Abbrev
2+
Addrinfo
3+
AliasObject
4+
AliasObject2
5+
AnonWithConstant
6+
ArbitraryException
7+
ArraySub
8+
ArraySubPush
9+
AryChild
10+
Base64
11+
BaseClass
12+
BasicSocket
13+
BeCloseToMatrixMatcher
14+
BigDecimal
15+
BigMath
16+
BitwiseAndTest
17+
BreakTest
18+
BreakTest2
19+
CAPI_SIZEOF_LONG
20+
CApiModuleSpecsAutoload
21+
CApiModuleSpecsModuleA
22+
CGI
23+
CMath
24+
CODE_LOADING_DIR
25+
CSAutoloadA
26+
CSAutoloadB
27+
CSAutoloadC
28+
CSAutoloadD
29+
CSV
30+
ChainedNextTest
31+
Channel
32+
ChildClass
33+
ClassIdUnderAutoload
34+
ClassSpecDefineClass
35+
ClassSpecsKeywordWithSemicolon
36+
ClassSpecsKeywordWithoutSemicolon
37+
ClassSpecsNumber
38+
ClassUnderAutoload
39+
CodingUS_ASCII
40+
CodingUTF_8
41+
ComparisonTest
42+
ConstantSpecsIncludedModule
43+
ConstantVisibility
44+
Coverage
45+
CustomArgumentError
46+
DRb
47+
DRbIdConv
48+
DRbObject
49+
DRbUndumped
50+
Date
51+
DateTime
52+
DefSpecNested
53+
DefSpecNestedB
54+
DefSpecSingleton
55+
DefSpecsLambdaVisibility
56+
DefineMethodByProcClass
57+
DefineMethodSpecClass
58+
DefineSingletonMethodSpecClass
59+
DescArray
60+
DescObjectTest
61+
Digest
62+
DumpableDir
63+
ERB
64+
EnsureInClassExample
65+
EnumerableSpecGrep
66+
EnumerableSpecGrep2
67+
EnumerableSpecIncludeP
68+
EnumerableSpecIncludeP11
69+
Etc
70+
EvalBindingA
71+
EvalBindingProcA
72+
Exception2MessageMapper
73+
ExceptionForMatrix
74+
Fcntl
75+
FileStat
76+
FileUtils
77+
Find
78+
Forwardable
79+
GetoptLong
80+
HMACConstants
81+
HashStringsASCII8BIT
82+
HashStringsUSASCII
83+
HashStringsUTF8
84+
IPAddr
85+
IPSocket
86+
Importer
87+
IncludeSpecsClass
88+
IncludeSpecsMiddle
89+
IncludeSpecsTop
90+
IncludesMath
91+
InvalidTostrTest
92+
JSON
93+
KSAutoloadA
94+
KSAutoloadB
95+
KSAutoloadBB
96+
KSAutoloadCallsRequire
97+
KSAutoloadD
98+
Logger
99+
MD5Constants
100+
MY_INPUT4_FOR_ERB
101+
Matrix
102+
MatrixSub
103+
MethodArity
104+
Meths
105+
MethsMore
106+
Mixin
107+
ModuleSpecsKeywordWithoutSemicolon
108+
ModuleSpecsToplevel
109+
ModuleSpecs_CS1
110+
ModuleSpecs_CS2
111+
ModuleSpecs_CS3
112+
MyClass
113+
MyClass0ForErb
114+
MyClass1ForErb
115+
MyClass1ForErb_
116+
MyClass2ForErb
117+
MyClass4ForErb
118+
MyFiber
119+
MyModule2ForErb
120+
MyString
121+
NamespaceTest
122+
Net
123+
OBJDIR
124+
OBJECT_SPACE_TOP_LEVEL_CONSTANT
125+
OFor
126+
ObjectSpaceFixtures
127+
ObjectSpecDup
128+
ObjectSpecDupInitCopy
129+
ObjectTest
130+
Observable
131+
Open3
132+
OpenSSL
133+
OpenStruct
134+
OperatorImplementor
135+
OptParse
136+
OptionParser
137+
OrAndXorTest
138+
OtherCustomException
139+
ParentClass
140+
Pathname
141+
Person
142+
Prime
143+
Private
144+
ProcFromMethod
145+
Psych
146+
REXML
147+
RUBY_SIGNALS
148+
RbReadline
149+
Readline
150+
ReceiverClass
151+
RegexpSpecsSubclass
152+
RegexpSpecsSubclassTwo
153+
RescueInClassExample
154+
Resolv
155+
SHA1Constants
156+
SHA256Constants
157+
SHA384Constants
158+
SHA512Constants
159+
SameName
160+
ScanError
161+
Scanf
162+
SecondClass
163+
SecureRandom
164+
Set
165+
Shellwords
166+
SingleForwardable
167+
Singleton
168+
Socket
169+
SocketError
170+
SomeClass
171+
SortedSet
172+
SpecificExampleException
173+
Specs
174+
StrChild
175+
StrangeEach
176+
StringRefinement
177+
StringScanner
178+
StringSubclass
179+
StructClasses
180+
Syslog
181+
TCPServer
182+
TCPSocket
183+
TSort
184+
Tempfile
185+
TestServer
186+
Timeout
187+
TimeoutError
188+
UDPSocket
189+
UNIXServer
190+
UNIXSocket
191+
UnaryMinusTest
192+
UnicodeNormalize
193+
UnloadableDumpableDir
194+
UserArray
195+
UserCustomConstructorString
196+
UserDefined
197+
UserDefinedImmediate
198+
UserDefinedWithIvar
199+
UserHash
200+
UserHashInitParams
201+
UserMarshal
202+
UserMarshalWithClassName
203+
UserMarshalWithIvar
204+
UserObject
205+
UserPreviouslyDefinedWithInitializedIvar
206+
UserRegexp
207+
UserString
208+
ValidTostrTest
209+
Vector
210+
WEBrick
211+
WIN32OLE
212+
WIN32OLEQueryInterfaceError
213+
WIN32OLERuntimeError
214+
WIN32OLE_EVENT
215+
WIN32OLE_METHOD
216+
WIN32OLE_PARAM
217+
WIN32OLE_RECORD
218+
WIN32OLE_RUBYSPEC
219+
WIN32OLE_TYPE
220+
WIN32OLE_TYPELIB
221+
WIN32OLE_VARIABLE
222+
WIN32OLE_VARIANT
223+
WeakRef
224+
Win32
225+
YAML
226+
Zlib

spec/ruby/.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ matrix:
1313
env: CHECK_LEAKS=true
1414
- rvm: 2.5.3
1515
env: CHECK_LEAKS=true
16-
- rvm: 2.6.0
16+
- rvm: 2.6.1
1717
env: CHECK_LEAKS=true
1818
- env: RUBOCOP=true
1919
rvm: 2.4.5

spec/ruby/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,23 @@ In similar fashion, the following commands run the respective specs:
9898
$ ../mspec/bin/mspec :library
9999
$ ../mspec/bin/mspec :capi
100100

101+
### Sanity Checks When Running Specs
102+
103+
A number of checks for various kind of "leaks" (file descriptors, temporary files,
104+
threads, subprocesses, `ENV`, `ARGV`, global encodings, top-level constants) can be
105+
enabled with `CHECK_LEAKS=true`:
106+
107+
$ CHECK_LEAKS=true ../mspec/bin/mspec
108+
109+
New top-level constants should only be introduced when needed or follow the
110+
pattern `<ClassBeingTested>Specs` such as `module StringSpecs`.
111+
Other constants used for testing should be nested under such a module.
112+
113+
Exceptions to these rules are contained in the file `.mspec.constants`.
114+
MSpec can automatically add new top-level constants in this file with:
115+
116+
$ CHECK_LEAKS=save mspec ../mspec/bin/mspec file
117+
101118
### Contributing and Writing Specs
102119

103120
See [CONTRIBUTING.md](https://github.com/ruby/spec/blob/master/CONTRIBUTING.md) for documentation about contributing and writing specs (guards, matchers, etc).

spec/ruby/core/array/combination_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
@array.combination(-1).size.should == 0
5959
[].combination(-2).size.should == 0
6060
end
61-
it "returns the binomial coeficient between the array size the number of combinations" do
61+
it "returns the binomial coefficient between the array size the number of combinations" do
6262
@array.combination(5).size.should == 0
6363
@array.combination(4).size.should == 1
6464
@array.combination(3).size.should == 4

spec/ruby/core/array/fixtures/classes.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def initialize(*args)
8181
end
8282
end
8383

84-
class ArrayConvertable
84+
class ArrayConvertible
8585
attr_accessor :called
8686
def initialize(*values, &block)
8787
@values = values;
@@ -426,7 +426,7 @@ def self.universal_pack_object
426426
"assert_no_queries",
427427
"test_change_column_quotes_column_names",
428428
"assert_match",
429-
"test_keeping_default_and_notnull_constaint_on_change",
429+
"test_keeping_default_and_notnull_constraint_on_change",
430430
"methods",
431431
"connection_allow_concurrency_setup",
432432
"connection_allow_concurrency_teardown",
@@ -476,7 +476,7 @@ def self.universal_pack_object
476476
"test_create_table_without_id",
477477
"test_finds_migrations",
478478
"test_finds_pending_migrations",
479-
"test_keeping_default_and_notnull_constaint_on_change",
479+
"test_keeping_default_and_notnull_constraint_on_change",
480480
"test_migrator",
481481
"test_migrator_db_has_no_schema_migrations_table",
482482
"test_migrator_double_down",

spec/ruby/core/array/last_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
array.last.should equal(array)
5454
end
5555

56-
it "tries to convert the passed argument to an Integer usinig #to_int" do
56+
it "tries to convert the passed argument to an Integer using #to_int" do
5757
obj = mock('to_int')
5858
obj.should_receive(:to_int).and_return(2)
5959
[1, 2, 3, 4, 5].last(obj).should == [4, 5]

spec/ruby/core/array/pack/shared/float.rb

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,9 @@
4141
[-infinity_value].pack(pack_format).should == "\x00\x00\x80\xff"
4242
end
4343

44-
platform_is "86" do # x86 / x86_64
45-
it "encodes NaN" do
46-
[nan_value].pack(pack_format).should == "\x00\x00\xc0\xff"
47-
end
48-
end
49-
50-
platform_is "powerpc64" do
51-
it "encodes NaN" do
52-
[nan_value].pack(pack_format).should == "\x00\x00\xc0\x7f"
53-
end
44+
it "encodes NaN" do
45+
nans = ["\x00\x00\xc0\xff", "\x00\x00\xc0\x7f", "\xFF\xFF\xFF\x7F"]
46+
nans.should include([nan_value].pack(pack_format))
5447
end
5548

5649
it "encodes a positive Float outside the range of a single precision float" do
@@ -103,16 +96,9 @@
10396
[-infinity_value].pack(pack_format).should == "\xff\x80\x00\x00"
10497
end
10598

106-
platform_is "86" do # x86 / x86_64
107-
it "encodes NaN" do
108-
[nan_value].pack(pack_format).should == "\xff\xc0\x00\x00"
109-
end
110-
end
111-
112-
platform_is "powerpc64" do
113-
it "encodes NaN" do
114-
[nan_value].pack(pack_format).should == "\x7f\xc0\x00\x00"
115-
end
99+
it "encodes NaN" do
100+
nans = ["\xff\xc0\x00\x00", "\x7f\xc0\x00\x00", "\x7F\xFF\xFF\xFF"]
101+
nans.should include([nan_value].pack(pack_format))
116102
end
117103

118104
it "encodes a positive Float outside the range of a single precision float" do
@@ -165,16 +151,13 @@
165151
[-infinity_value].pack(pack_format).should == "\x00\x00\x00\x00\x00\x00\xf0\xff"
166152
end
167153

168-
platform_is "86" do # x86 / x86_64
169-
it "encodes NaN" do
170-
[nan_value].pack(pack_format).should == "\x00\x00\x00\x00\x00\x00\xf8\xff"
171-
end
172-
end
173-
174-
platform_is "powerpc64" do
175-
it "encodes NaN" do
176-
[nan_value].pack(pack_format).should == "\x00\x00\x00\x00\x00\x00\xf8\x7f"
177-
end
154+
it "encodes NaN" do
155+
nans = [
156+
"\x00\x00\x00\x00\x00\x00\xf8\xff",
157+
"\x00\x00\x00\x00\x00\x00\xf8\x7f",
158+
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x7F"
159+
]
160+
nans.should include([nan_value].pack(pack_format))
178161
end
179162

180163
it "encodes a positive Float outside the range of a single precision float" do
@@ -227,16 +210,13 @@
227210
[-infinity_value].pack(pack_format).should == "\xff\xf0\x00\x00\x00\x00\x00\x00"
228211
end
229212

230-
platform_is "86" do # x86 / x86_64
231-
it "encodes NaN" do
232-
[nan_value].pack(pack_format).should == "\xff\xf8\x00\x00\x00\x00\x00\x00"
233-
end
234-
end
235-
236-
platform_is "powerpc64" do
237-
it "encodes NaN" do
238-
[nan_value].pack(pack_format).should == "\x7f\xf8\x00\x00\x00\x00\x00\x00"
239-
end
213+
it "encodes NaN" do
214+
nans = [
215+
"\xff\xf8\x00\x00\x00\x00\x00\x00",
216+
"\x7f\xf8\x00\x00\x00\x00\x00\x00",
217+
"\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
218+
]
219+
nans.should include([nan_value].pack(pack_format))
240220
end
241221

242222
it "encodes a positive Float outside the range of a single precision float" do

0 commit comments

Comments
 (0)