⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Backport187
All Projects
Ruby
»
Backport187
Overview
Activity
Issues
Like
Download (1.78 KB)
Backport #5876
» testModule.rb
nlgunther (Nick Gunther)
, 01/11/2012 05:59 AM
require
'OtherFileWithModules'
puts
`ruby -v`
module
TestModule
class
Array
include
ArrayMethods
end
class
Test
# The main class to hold rate data from a report in a tabular format
def
initialize
ar
=
[
1
,
2
]
# allow for Hash values of the form [regexp, capture group number = 0]
puts
"Compare the results for Testing Equivalences of
\n
Classes and Classes Converted to String:"
puts
"******"
puts
"Testing Class Equivalence:"
if
ar
.
class
!=
Array
puts
"The class is an array:
#{
ar
.
class
}
"
puts
"But we're in the branch where array class equivalence
\n
tested false, so there's a problem!"
else
puts
"No Problem"
end
puts
'WORKAROUND: Testing Equivalence After Converting to Strings:'
if
ar
.
class
.
to_s
!=
'Array'
puts
ar
.
class
puts
"There's a problem!"
else
puts
"No Problem"
end
end
end
end
class
Array
include
ArrayMethods
end
class
Test
# The main class to hold rate data from a report in a tabular format
def
initialize
ar
=
[
1
,
2
]
# allow for Hash values of the form [regexp, capture group number = 0]
puts
"Class and Class Converted to String:"
puts
"******"
puts
"Testing Class Equivalence"
if
ar
.
class
!=
Array
puts
"The class is an array:
#{
ar
.
class
}
"
puts
"But we're in the branch where array class equivalence
\n
tested false, so there's a problem!"
else
puts
"No Problem"
end
puts
'Testing Equivalence After Converting to Strings'
if
ar
.
class
.
to_s
!=
'Array'
puts
ar
.
class
puts
"A problem"
else
puts
"No Problem"
end
end
end
puts
"FIRST: Testing Within a Module: Displays the Problem and the Workaround
\n
= Converting to Strings"
puts
TestModule
::
Test
.
new
puts
"SECOND: Testing Outside a Module: No problem"
puts
Test
.
new
« Previous
1
2
3
Next »
(2-2/3)
Loading...