mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #5845 from jbampton/ruby-fix-whitespace
ruby: standardize whitespace
This commit is contained in:
@@ -12,7 +12,7 @@ MRuby::CrossBuild.new("Galileo") do |conf|
|
|||||||
#ARDUINO_GALILEO_PATH = '/opt/arduino'
|
#ARDUINO_GALILEO_PATH = '/opt/arduino'
|
||||||
|
|
||||||
GALILEO_BIN_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i386-pokysdk-darwin/usr/bin/i586-poky-linux-uclibc"
|
GALILEO_BIN_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i386-pokysdk-darwin/usr/bin/i586-poky-linux-uclibc"
|
||||||
GALILEO_SYSROOT = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc"
|
GALILEO_SYSROOT = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc"
|
||||||
GALILEO_X86_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/arduino/x86"
|
GALILEO_X86_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/arduino/x86"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,11 @@
|
|||||||
#
|
#
|
||||||
# 4. Confirm that drive 'z:' is mapped to your root filesystem.
|
# 4. Confirm that drive 'z:' is mapped to your root filesystem.
|
||||||
# (This is supposed to be a default but it helps to
|
# (This is supposed to be a default but it helps to
|
||||||
# double-check.) To confirm, run:
|
# double-check.) To confirm, run:
|
||||||
#
|
#
|
||||||
# wine cmd /c dir 'z:\\'
|
# wine cmd /c dir 'z:\\'
|
||||||
#
|
#
|
||||||
# This should give you a DOS-style equivalent of 'ls /'. If not,
|
# This should give you a DOS-style equivalent of 'ls /'. If not,
|
||||||
# you'll need to fix that with winecfg or by adding a symlink to
|
# you'll need to fix that with winecfg or by adding a symlink to
|
||||||
# '~/.wine/dosdevices'.
|
# '~/.wine/dosdevices'.
|
||||||
#
|
#
|
||||||
@@ -40,8 +40,8 @@
|
|||||||
#
|
#
|
||||||
# 1. This works by using a helper script that rewrites test output
|
# 1. This works by using a helper script that rewrites test output
|
||||||
# to make it look *nix-like and then handing it back to the test
|
# to make it look *nix-like and then handing it back to the test
|
||||||
# cases. Some of the existing tests were (slightly) modified to
|
# cases. Some of the existing tests were (slightly) modified to
|
||||||
# make this easier but only for the 'full-core' gembox. Other
|
# make this easier but only for the 'full-core' gembox. Other
|
||||||
# gems' bintests may or may not work with the helper script and
|
# gems' bintests may or may not work with the helper script and
|
||||||
# may or may not be fixable by extending the script.
|
# may or may not be fixable by extending the script.
|
||||||
#
|
#
|
||||||
@@ -50,11 +50,11 @@
|
|||||||
#
|
#
|
||||||
# 3. This script assumes you are running it on a *nix-style OS.
|
# 3. This script assumes you are running it on a *nix-style OS.
|
||||||
#
|
#
|
||||||
# 4. I recommend building 64-bit targets only. Building a 32-bit
|
# 4. I recommend building 64-bit targets only. Building a 32-bit
|
||||||
# Windows binary with i686-w64-mingw32 seems to work (at least,
|
# Windows binary with i686-w64-mingw32 seems to work (at least,
|
||||||
# it did for me) but the resulting executable failed a number of
|
# it did for me) but the resulting executable failed a number of
|
||||||
# unit tests due to small errors in some floating-point
|
# unit tests due to small errors in some floating-point
|
||||||
# operations. It's unclear if this indicates more serious problems.
|
# operations. It's unclear if this indicates more serious problems.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ def main
|
|||||||
end
|
end
|
||||||
|
|
||||||
# For simplicity, just read all of stdin into memory and pass that
|
# For simplicity, just read all of stdin into memory and pass that
|
||||||
# as an argument when invoking wine. (Skipped if STDIN was not
|
# as an argument when invoking wine. (Skipped if STDIN was not
|
||||||
# redirected.)
|
# redirected.)
|
||||||
if !STDIN.tty?
|
if !STDIN.tty?
|
||||||
input = STDIN.read
|
input = STDIN.read
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ module MRuby
|
|||||||
@gemdir = gemdir # Working copy of the gem
|
@gemdir = gemdir # Working copy of the gem
|
||||||
@path = path # Path to gem relative to checkout
|
@path = path # Path to gem relative to checkout
|
||||||
|
|
||||||
@repo = repo # Remote gem repo
|
@repo = repo # Remote gem repo
|
||||||
@branch = branch # Branch to check out
|
@branch = branch # Branch to check out
|
||||||
@commit = commit # Commit-id to use
|
@commit = commit # Commit-id to use
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ module MRuby
|
|||||||
gem_src = File.expand_path(gem_src, File.dirname(MRuby::GemBox.path))
|
gem_src = File.expand_path(gem_src, File.dirname(MRuby::GemBox.path))
|
||||||
else
|
else
|
||||||
# Otherwise, we use the path to the build_config.rb file that
|
# Otherwise, we use the path to the build_config.rb file that
|
||||||
# requested this gem. This path was extracted earlier and
|
# requested this gem. This path was extracted earlier and
|
||||||
# stored in @build_config_dir via the second argument of
|
# stored in @build_config_dir via the second argument of
|
||||||
# 'initialize'.
|
# 'initialize'.
|
||||||
root_dir = @build_config_dir
|
root_dir = @build_config_dir
|
||||||
@@ -308,10 +308,10 @@ module MRuby
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Test if this repo can be skipped. This will happen if it's
|
# Test if this repo can be skipped. This will happen if it's
|
||||||
# already in @gem_checkouts and EITHER it is identical (same
|
# already in @gem_checkouts and EITHER it is identical (same
|
||||||
# url, branch, commit-ID and subdirectory path) as the current
|
# url, branch, commit-ID and subdirectory path) as the current
|
||||||
# checkout OR its "canonical" flag is true. If it's in
|
# checkout OR its "canonical" flag is true. If it's in
|
||||||
# @gem_checkouts and neither of these conditions is true, that's
|
# @gem_checkouts and neither of these conditions is true, that's
|
||||||
# a fatal error; it means there are multiple incompatible
|
# a fatal error; it means there are multiple incompatible
|
||||||
# versions of this gem to be checked out into this directory.
|
# versions of this gem to be checked out into this directory.
|
||||||
@@ -340,14 +340,14 @@ module MRuby
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Otherwise, we have a checkout conflict. This is an error.
|
# Otherwise, we have a checkout conflict. This is an error.
|
||||||
fail "Conflicting gem definitions for '#{repo_dir}':\n" +
|
fail "Conflicting gem definitions for '#{repo_dir}':\n" +
|
||||||
" #{candidate}\n" +
|
" #{candidate}\n" +
|
||||||
" #{prev}\n"
|
" #{prev}\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Retrieve a git repo if it's not present. Return
|
# Retrieve a git repo if it's not present. Return
|
||||||
# [path_to_checkout, did_clone]
|
# [path_to_checkout, did_clone]
|
||||||
def git_clone_dependency(url, repo_dir, commit, branch)
|
def git_clone_dependency(url, repo_dir, commit, branch)
|
||||||
return if
|
return if
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ class Array
|
|||||||
#
|
#
|
||||||
# Returns a new array that is a one-dimensional flattening of this
|
# Returns a new array that is a one-dimensional flattening of this
|
||||||
# array (recursively). That is, for every element that is an array,
|
# array (recursively). That is, for every element that is an array,
|
||||||
# extract its elements into the new array. If the optional
|
# extract its elements into the new array. If the optional
|
||||||
# <i>level</i> argument determines the level of recursion to flatten.
|
# <i>level</i> argument determines the level of recursion to flatten.
|
||||||
#
|
#
|
||||||
# s = [ 1, 2, 3 ] #=> [1, 2, 3]
|
# s = [ 1, 2, 3 ] #=> [1, 2, 3]
|
||||||
@@ -262,7 +262,7 @@ class Array
|
|||||||
#
|
#
|
||||||
# Flattens +self+ in place.
|
# Flattens +self+ in place.
|
||||||
# Returns <code>nil</code> if no modifications were made (i.e.,
|
# Returns <code>nil</code> if no modifications were made (i.e.,
|
||||||
# <i>ary</i> contains no subarrays.) If the optional <i>level</i>
|
# <i>ary</i> contains no subarrays.) If the optional <i>level</i>
|
||||||
# argument determines the level of recursion to flatten.
|
# argument determines the level of recursion to flatten.
|
||||||
#
|
#
|
||||||
# a = [ 1, 2, [3, [4, 5] ] ]
|
# a = [ 1, 2, [3, [4, 5] ] ]
|
||||||
@@ -313,7 +313,7 @@ class Array
|
|||||||
# ary.fetch(index) { |index| block } -> obj
|
# ary.fetch(index) { |index| block } -> obj
|
||||||
#
|
#
|
||||||
# Tries to return the element at position +index+, but throws an IndexError
|
# Tries to return the element at position +index+, but throws an IndexError
|
||||||
# exception if the referenced +index+ lies outside of the array bounds. This
|
# exception if the referenced +index+ lies outside of the array bounds. This
|
||||||
# error can be prevented by supplying a second argument, which will act as a
|
# error can be prevented by supplying a second argument, which will act as a
|
||||||
# +default+ value.
|
# +default+ value.
|
||||||
#
|
#
|
||||||
@@ -539,7 +539,7 @@ class Array
|
|||||||
# the given condition in O(log n) where n is the size of the array.
|
# the given condition in O(log n) where n is the size of the array.
|
||||||
#
|
#
|
||||||
# You can use this method in two use cases: a find-minimum mode and
|
# You can use this method in two use cases: a find-minimum mode and
|
||||||
# a find-any mode. In either case, the elements of the array must be
|
# a find-any mode. In either case, the elements of the array must be
|
||||||
# monotone (or sorted) with respect to the block.
|
# monotone (or sorted) with respect to the block.
|
||||||
#
|
#
|
||||||
# In find-minimum mode (this is a good choice for typical use case),
|
# In find-minimum mode (this is a good choice for typical use case),
|
||||||
@@ -551,7 +551,7 @@ class Array
|
|||||||
# - the block returns true for any element whose index is greater
|
# - the block returns true for any element whose index is greater
|
||||||
# than or equal to i.
|
# than or equal to i.
|
||||||
#
|
#
|
||||||
# This method returns the i-th element. If i is equal to ary.size,
|
# This method returns the i-th element. If i is equal to ary.size,
|
||||||
# it returns nil.
|
# it returns nil.
|
||||||
#
|
#
|
||||||
# ary = [0, 4, 7, 10, 12]
|
# ary = [0, 4, 7, 10, 12]
|
||||||
@@ -570,7 +570,7 @@ class Array
|
|||||||
# j <= k < ary.size.
|
# j <= k < ary.size.
|
||||||
#
|
#
|
||||||
# Under this condition, this method returns any element whose index
|
# Under this condition, this method returns any element whose index
|
||||||
# is within i...j. If i is equal to j (i.e., there is no element
|
# is within i...j. If i is equal to j (i.e., there is no element
|
||||||
# that satisfies the block), this method returns nil.
|
# that satisfies the block), this method returns nil.
|
||||||
#
|
#
|
||||||
# ary = [0, 4, 7, 10, 12]
|
# ary = [0, 4, 7, 10, 12]
|
||||||
@@ -580,7 +580,7 @@ class Array
|
|||||||
# ary.bsearch {|x| 4 - (x / 2).truncate } #=> nil
|
# ary.bsearch {|x| 4 - (x / 2).truncate } #=> nil
|
||||||
#
|
#
|
||||||
# You must not mix the two modes at a time; the block must always
|
# You must not mix the two modes at a time; the block must always
|
||||||
# return either true/false, or always return a number. It is
|
# return either true/false, or always return a number. It is
|
||||||
# undefined which value is actually picked up at each iteration.
|
# undefined which value is actually picked up at each iteration.
|
||||||
|
|
||||||
def bsearch(&block)
|
def bsearch(&block)
|
||||||
@@ -707,7 +707,7 @@ class Array
|
|||||||
# <code>==</code> to +obj+.
|
# <code>==</code> to +obj+.
|
||||||
#
|
#
|
||||||
# If a block is given instead of an argument, returns the _index_ of the
|
# If a block is given instead of an argument, returns the _index_ of the
|
||||||
# first object for which the block returns +true+. Returns +nil+ if no
|
# first object for which the block returns +true+. Returns +nil+ if no
|
||||||
# match is found.
|
# match is found.
|
||||||
#
|
#
|
||||||
# ISO 15.2.12.5.14
|
# ISO 15.2.12.5.14
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ end
|
|||||||
|
|
||||||
assert('CMath trigonometric_functions') do
|
assert('CMath trigonometric_functions') do
|
||||||
assert_complex(Math.sinh(2).i, CMath.sin(2i))
|
assert_complex(Math.sinh(2).i, CMath.sin(2i))
|
||||||
assert_complex(Math.cosh(2)+0i, CMath.cos(2i))
|
assert_complex(Math.cosh(2)+0i, CMath.cos(2i))
|
||||||
assert_complex(Math.tanh(2).i, CMath.tan(2i))
|
assert_complex(Math.tanh(2).i, CMath.tan(2i))
|
||||||
assert_complex(Math.sin(2).i, CMath.sinh(2i))
|
assert_complex(Math.sin(2).i, CMath.sinh(2i))
|
||||||
assert_complex(Math.cos(2)+0i, CMath.cosh(2i))
|
assert_complex(Math.cos(2)+0i, CMath.cosh(2i))
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ module Enumerable
|
|||||||
#
|
#
|
||||||
# Returns the number of items in +enum+ through enumeration.
|
# Returns the number of items in +enum+ through enumeration.
|
||||||
# If an argument is given, the number of items in +enum+ that
|
# If an argument is given, the number of items in +enum+ that
|
||||||
# are equal to +item+ are counted. If a block is given, it
|
# are equal to +item+ are counted. If a block is given, it
|
||||||
# counts the number of elements yielding a true value.
|
# counts the number of elements yielding a true value.
|
||||||
def count(v=NONE, &block)
|
def count(v=NONE, &block)
|
||||||
count = 0
|
count = 0
|
||||||
@@ -368,7 +368,7 @@ module Enumerable
|
|||||||
# enum.minmax { |a, b| block } -> [min, max]
|
# enum.minmax { |a, b| block } -> [min, max]
|
||||||
#
|
#
|
||||||
# Returns two elements array which contains the minimum and the
|
# Returns two elements array which contains the minimum and the
|
||||||
# maximum value in the enumerable. The first form assumes all
|
# maximum value in the enumerable. The first form assumes all
|
||||||
# objects implement <code>Comparable</code>; the second uses the
|
# objects implement <code>Comparable</code>; the second uses the
|
||||||
# block to return <em>a <=> b</em>.
|
# block to return <em>a <=> b</em>.
|
||||||
#
|
#
|
||||||
@@ -647,8 +647,8 @@ module Enumerable
|
|||||||
# enum.cycle(n=nil) -> an_enumerator
|
# enum.cycle(n=nil) -> an_enumerator
|
||||||
#
|
#
|
||||||
# Calls <i>block</i> for each element of <i>enum</i> repeatedly _n_
|
# Calls <i>block</i> for each element of <i>enum</i> repeatedly _n_
|
||||||
# times or forever if none or +nil+ is given. If a non-positive
|
# times or forever if none or +nil+ is given. If a non-positive
|
||||||
# number is given or the collection is empty, does nothing. Returns
|
# number is given or the collection is empty, does nothing. Returns
|
||||||
# +nil+ if the loop has finished without getting interrupted.
|
# +nil+ if the loop has finished without getting interrupted.
|
||||||
#
|
#
|
||||||
# Enumerable#cycle saves elements in an internal array so changes
|
# Enumerable#cycle saves elements in an internal array so changes
|
||||||
@@ -696,7 +696,7 @@ module Enumerable
|
|||||||
# enum.find_index -> an_enumerator
|
# enum.find_index -> an_enumerator
|
||||||
#
|
#
|
||||||
# Compares each entry in <i>enum</i> with <em>value</em> or passes
|
# Compares each entry in <i>enum</i> with <em>value</em> or passes
|
||||||
# to <em>block</em>. Returns the index for the first for which the
|
# to <em>block</em>. Returns the index for the first for which the
|
||||||
# evaluated value is non-false. If no object matches, returns
|
# evaluated value is non-false. If no object matches, returns
|
||||||
# <code>nil</code>
|
# <code>nil</code>
|
||||||
#
|
#
|
||||||
@@ -731,10 +731,10 @@ module Enumerable
|
|||||||
# enum.zip(arg, ...) { |arr| block } -> nil
|
# enum.zip(arg, ...) { |arr| block } -> nil
|
||||||
#
|
#
|
||||||
# Takes one element from <i>enum</i> and merges corresponding
|
# Takes one element from <i>enum</i> and merges corresponding
|
||||||
# elements from each <i>args</i>. This generates a sequence of
|
# elements from each <i>args</i>. This generates a sequence of
|
||||||
# <em>n</em>-element arrays, where <em>n</em> is one more than the
|
# <em>n</em>-element arrays, where <em>n</em> is one more than the
|
||||||
# count of arguments. The length of the resulting sequence will be
|
# count of arguments. The length of the resulting sequence will be
|
||||||
# <code>enum#size</code>. If the size of any argument is less than
|
# <code>enum#size</code>. If the size of any argument is less than
|
||||||
# <code>enum#size</code>, <code>nil</code> values are supplied. If
|
# <code>enum#size</code>, <code>nil</code> values are supplied. If
|
||||||
# a block is given, it is invoked for each output array, otherwise
|
# a block is given, it is invoked for each output array, otherwise
|
||||||
# an array of arrays is returned.
|
# an array of arrays is returned.
|
||||||
@@ -844,7 +844,7 @@ module Enumerable
|
|||||||
# call-seq:
|
# call-seq:
|
||||||
# enum.tally -> a_hash
|
# enum.tally -> a_hash
|
||||||
#
|
#
|
||||||
# Tallys the collection. Returns a hash where the keys are the
|
# Tallys the collection. Returns a hash where the keys are the
|
||||||
# elements and the values are numbers of elements in the collection
|
# elements and the values are numbers of elements in the collection
|
||||||
# that correspond to the key.
|
# that correspond to the key.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
# # foo: two
|
# # foo: two
|
||||||
# # foo: three
|
# # foo: three
|
||||||
#
|
#
|
||||||
# This allows you to chain Enumerators together. For example, you
|
# This allows you to chain Enumerators together. For example, you
|
||||||
# can map a list's elements to strings containing the index
|
# can map a list's elements to strings containing the index
|
||||||
# and the element as a string via:
|
# and the element as a string via:
|
||||||
#
|
#
|
||||||
@@ -112,7 +112,7 @@ class Enumerator
|
|||||||
# given object using the given method with the given arguments passed. This
|
# given object using the given method with the given arguments passed. This
|
||||||
# form is left only for internal use.
|
# form is left only for internal use.
|
||||||
#
|
#
|
||||||
# Use of this form is discouraged. Use Kernel#enum_for or Kernel#to_enum
|
# Use of this form is discouraged. Use Kernel#enum_for or Kernel#to_enum
|
||||||
# instead.
|
# instead.
|
||||||
def initialize(obj=NONE, meth=:each, *args, **kwd, &block)
|
def initialize(obj=NONE, meth=:each, *args, **kwd, &block)
|
||||||
if block
|
if block
|
||||||
@@ -154,7 +154,7 @@ class Enumerator
|
|||||||
# e.with_index(offset = 0)
|
# e.with_index(offset = 0)
|
||||||
#
|
#
|
||||||
# Iterates the given block for each element with an index, which
|
# Iterates the given block for each element with an index, which
|
||||||
# starts from +offset+. If no block is given, returns a new Enumerator
|
# starts from +offset+. If no block is given, returns a new Enumerator
|
||||||
# that includes the index, starting from +offset+
|
# that includes the index, starting from +offset+
|
||||||
#
|
#
|
||||||
# +offset+:: the starting index to use
|
# +offset+:: the starting index to use
|
||||||
@@ -297,7 +297,7 @@ class Enumerator
|
|||||||
# e.next -> object
|
# e.next -> object
|
||||||
#
|
#
|
||||||
# Returns the next object in the enumerator, and move the internal position
|
# Returns the next object in the enumerator, and move the internal position
|
||||||
# forward. When the position reached at the end, StopIteration is raised.
|
# forward. When the position reached at the end, StopIteration is raised.
|
||||||
#
|
#
|
||||||
# === Example
|
# === Example
|
||||||
#
|
#
|
||||||
@@ -321,7 +321,7 @@ class Enumerator
|
|||||||
# e.next_values -> array
|
# e.next_values -> array
|
||||||
#
|
#
|
||||||
# Returns the next object as an array in the enumerator, and move the
|
# Returns the next object as an array in the enumerator, and move the
|
||||||
# internal position forward. When the position reached at the end,
|
# internal position forward. When the position reached at the end,
|
||||||
# StopIteration is raised.
|
# StopIteration is raised.
|
||||||
#
|
#
|
||||||
# This method can be used to distinguish <code>yield</code> and <code>yield
|
# This method can be used to distinguish <code>yield</code> and <code>yield
|
||||||
@@ -405,7 +405,7 @@ class Enumerator
|
|||||||
# e.peek -> object
|
# e.peek -> object
|
||||||
#
|
#
|
||||||
# Returns the next object in the enumerator, but doesn't move the internal
|
# Returns the next object in the enumerator, but doesn't move the internal
|
||||||
# position forward. If the position is already at the end, StopIteration
|
# position forward. If the position is already at the end, StopIteration
|
||||||
# is raised.
|
# is raised.
|
||||||
#
|
#
|
||||||
# === Example
|
# === Example
|
||||||
@@ -429,7 +429,7 @@ class Enumerator
|
|||||||
# e.peek_values -> array
|
# e.peek_values -> array
|
||||||
#
|
#
|
||||||
# Returns the next object as an array, similar to Enumerator#next_values, but
|
# Returns the next object as an array, similar to Enumerator#next_values, but
|
||||||
# doesn't move the internal position forward. If the position is already at
|
# doesn't move the internal position forward. If the position is already at
|
||||||
# the end, StopIteration is raised.
|
# the end, StopIteration is raised.
|
||||||
#
|
#
|
||||||
# === Example
|
# === Example
|
||||||
@@ -564,7 +564,7 @@ class Enumerator
|
|||||||
# Enumerator.produce(initial = nil) { |val| } -> enumerator
|
# Enumerator.produce(initial = nil) { |val| } -> enumerator
|
||||||
#
|
#
|
||||||
# Creates an infinite enumerator from any block, just called over and
|
# Creates an infinite enumerator from any block, just called over and
|
||||||
# over. Result of the previous iteration is passed to the next one.
|
# over. Result of the previous iteration is passed to the next one.
|
||||||
# If +initial+ is provided, it is passed to the first iteration, and
|
# If +initial+ is provided, it is passed to the first iteration, and
|
||||||
# becomes the first element of the enumerator; if it is not provided,
|
# becomes the first element of the enumerator; if it is not provided,
|
||||||
# first iteration receives +nil+, and its result becomes first
|
# first iteration receives +nil+, and its result becomes first
|
||||||
|
|||||||
@@ -139,12 +139,12 @@ end
|
|||||||
|
|
||||||
assert('Transfer to self.') do
|
assert('Transfer to self.') do
|
||||||
result = []
|
result = []
|
||||||
f = Fiber.new { result << :start; f.transfer; result << :end }
|
f = Fiber.new { result << :start; f.transfer; result << :end }
|
||||||
f.transfer
|
f.transfer
|
||||||
assert_equal [:start, :end], result
|
assert_equal [:start, :end], result
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
f = Fiber.new { result << :start; f.transfer; result << :end }
|
f = Fiber.new { result << :start; f.transfer; result << :end }
|
||||||
f.resume
|
f.resume
|
||||||
assert_equal [:start, :end], result
|
assert_equal [:start, :end], result
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Hash
|
class Hash
|
||||||
|
|
||||||
# ISO does not define Hash#each_pair, so each_pair is defined in gem.
|
# ISO does not define Hash#each_pair, so each_pair is defined in gem.
|
||||||
alias each_pair each
|
alias each_pair each
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -65,7 +65,7 @@ class Hash
|
|||||||
# hsh.merge!(other_hash..) -> hsh
|
# hsh.merge!(other_hash..) -> hsh
|
||||||
# hsh.merge!(other_hash..){|key, oldval, newval| block} -> hsh
|
# hsh.merge!(other_hash..){|key, oldval, newval| block} -> hsh
|
||||||
#
|
#
|
||||||
# Adds the contents of _other_hash_ to _hsh_. If no block is specified,
|
# Adds the contents of _other_hash_ to _hsh_. If no block is specified,
|
||||||
# entries with duplicate keys are overwritten with the values from
|
# entries with duplicate keys are overwritten with the values from
|
||||||
# _other_hash_, otherwise the value of each duplicate key is determined by
|
# _other_hash_, otherwise the value of each duplicate key is determined by
|
||||||
# calling the block with the key, its value in _hsh_ and its value in
|
# calling the block with the key, its value in _hsh_ and its value in
|
||||||
@@ -217,8 +217,8 @@ class Hash
|
|||||||
#
|
#
|
||||||
# Returns a new array that is a one-dimensional flattening of this
|
# Returns a new array that is a one-dimensional flattening of this
|
||||||
# hash. That is, for every key or value that is an array, extract
|
# hash. That is, for every key or value that is an array, extract
|
||||||
# its elements into the new array. Unlike Array#flatten, this
|
# its elements into the new array. Unlike Array#flatten, this
|
||||||
# method does not flatten recursively by default. The optional
|
# method does not flatten recursively by default. The optional
|
||||||
# <i>level</i> argument determines the level of recursion to flatten.
|
# <i>level</i> argument determines the level of recursion to flatten.
|
||||||
#
|
#
|
||||||
# a = {1=> "one", 2 => [2,"two"], 3 => "three"}
|
# a = {1=> "one", 2 => [2,"two"], 3 => "three"}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ end
|
|||||||
|
|
||||||
assert('Hash#merge!') do
|
assert('Hash#merge!') do
|
||||||
a = { 'abc_key' => 'abc_value', 'cba_key' => 'cba_value' }
|
a = { 'abc_key' => 'abc_value', 'cba_key' => 'cba_value' }
|
||||||
b = { 'cba_key' => 'XXX', 'xyz_key' => 'xyz_value' }
|
b = { 'cba_key' => 'XXX', 'xyz_key' => 'xyz_value' }
|
||||||
|
|
||||||
result_1 = a.merge! b
|
result_1 = a.merge! b
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ end
|
|||||||
|
|
||||||
assert('File.extname') do
|
assert('File.extname') do
|
||||||
assert_equal '.txt', File.extname('foo/foo.txt')
|
assert_equal '.txt', File.extname('foo/foo.txt')
|
||||||
assert_equal '.gz', File.extname('foo/foo.tar.gz')
|
assert_equal '.gz', File.extname('foo/foo.tar.gz')
|
||||||
assert_equal '', File.extname('foo/bar')
|
assert_equal '', File.extname('foo/bar')
|
||||||
assert_equal '', File.extname('foo/.bar')
|
assert_equal '', File.extname('foo/.bar')
|
||||||
assert_equal '', File.extname('foo.txt/bar')
|
assert_equal '', File.extname('foo.txt/bar')
|
||||||
|
|||||||
@@ -272,13 +272,13 @@ end
|
|||||||
|
|
||||||
assert('Module#instance_methods', '15.2.2.4.33') do
|
assert('Module#instance_methods', '15.2.2.4.33') do
|
||||||
module Test4InstanceMethodsA
|
module Test4InstanceMethodsA
|
||||||
def method1() end
|
def method1() end
|
||||||
end
|
end
|
||||||
class Test4InstanceMethodsB
|
class Test4InstanceMethodsB
|
||||||
def method2() end
|
def method2() end
|
||||||
end
|
end
|
||||||
class Test4InstanceMethodsC < Test4InstanceMethodsB
|
class Test4InstanceMethodsC < Test4InstanceMethodsB
|
||||||
def method3() end
|
def method3() end
|
||||||
end
|
end
|
||||||
|
|
||||||
r = Test4InstanceMethodsC.instance_methods(true)
|
r = Test4InstanceMethodsC.instance_methods(true)
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ class String
|
|||||||
# call-seq:
|
# call-seq:
|
||||||
# str.center(width, padstr=' ') -> new_str
|
# str.center(width, padstr=' ') -> new_str
|
||||||
#
|
#
|
||||||
# Centers +str+ in +width+. If +width+ is greater than the length of +str+,
|
# Centers +str+ in +width+. If +width+ is greater than the length of +str+,
|
||||||
# returns a new String of length +width+ with +str+ centered and padded with
|
# returns a new String of length +width+ with +str+ centered and padded with
|
||||||
# +padstr+; otherwise, returns +str+.
|
# +padstr+; otherwise, returns +str+.
|
||||||
#
|
#
|
||||||
@@ -372,7 +372,7 @@ class String
|
|||||||
# Iterates through successive values, starting at <i>str</i> and
|
# Iterates through successive values, starting at <i>str</i> and
|
||||||
# ending at <i>other_str</i> inclusive, passing each value in turn to
|
# ending at <i>other_str</i> inclusive, passing each value in turn to
|
||||||
# the block. The <code>String#succ</code> method is used to generate
|
# the block. The <code>String#succ</code> method is used to generate
|
||||||
# each value. If optional second argument exclusive is omitted or is false,
|
# each value. If optional second argument exclusive is omitted or is false,
|
||||||
# the last value will be included; otherwise it will be excluded.
|
# the last value will be included; otherwise it will be excluded.
|
||||||
#
|
#
|
||||||
# If no block is given, an enumerator is returned instead.
|
# If no block is given, an enumerator is returned instead.
|
||||||
|
|||||||
+2
-2
@@ -176,7 +176,7 @@ class Array
|
|||||||
# Each object in each array is compared (using <=>). If any value isn't
|
# Each object in each array is compared (using <=>). If any value isn't
|
||||||
# equal, then that inequality is the return value. If all the
|
# equal, then that inequality is the return value. If all the
|
||||||
# values found are equal, then the return is based on a
|
# values found are equal, then the return is based on a
|
||||||
# comparison of the array lengths. Thus, two arrays are
|
# comparison of the array lengths. Thus, two arrays are
|
||||||
# "equal" according to <code>Array#<=></code> if and only if they have
|
# "equal" according to <code>Array#<=></code> if and only if they have
|
||||||
# the same length and the value of each element is equal to the
|
# the same length and the value of each element is equal to the
|
||||||
# value of the corresponding element in the other array.
|
# value of the corresponding element in the other array.
|
||||||
@@ -263,7 +263,7 @@ class Array
|
|||||||
lsize = lary.size
|
lsize = lary.size
|
||||||
|
|
||||||
# The entity sharing between lary and self may cause a large memory
|
# The entity sharing between lary and self may cause a large memory
|
||||||
# copy operation in the merge loop below. This harmless operation
|
# copy operation in the merge loop below. This harmless operation
|
||||||
# cancels the sharing and provides a huge performance gain.
|
# cancels the sharing and provides a huge performance gain.
|
||||||
lary[0] = lary[0]
|
lary[0] = lary[0]
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -167,7 +167,7 @@ class Hash
|
|||||||
# into a copy of +self+.
|
# into a copy of +self+.
|
||||||
#
|
#
|
||||||
# Each argument in +other_hashes+ must be a \Hash.
|
# Each argument in +other_hashes+ must be a \Hash.
|
||||||
# Adds the contents of _other_hash_ to _hsh_. If no block is specified,
|
# Adds the contents of _other_hash_ to _hsh_. If no block is specified,
|
||||||
# entries with duplicate keys are overwritten with the values from
|
# entries with duplicate keys are overwritten with the values from
|
||||||
# _other_hash_, otherwise the value of each duplicate key is determined by
|
# _other_hash_, otherwise the value of each duplicate key is determined by
|
||||||
# calling the block with the key, its value in _hsh_ and its value in
|
# calling the block with the key, its value in _hsh_ and its value in
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@ $ko_test = 0
|
|||||||
$kill_test = 0
|
$kill_test = 0
|
||||||
$warning_test = 0
|
$warning_test = 0
|
||||||
$skip_test = 0
|
$skip_test = 0
|
||||||
$asserts = []
|
$asserts = []
|
||||||
$test_start = Time.now if Object.const_defined?(:Time)
|
$test_start = Time.now if Object.const_defined?(:Time)
|
||||||
|
|
||||||
# For bintest on Ruby
|
# For bintest on Ruby
|
||||||
@@ -257,7 +257,7 @@ end
|
|||||||
# Matches any one character.
|
# Matches any one character.
|
||||||
#
|
#
|
||||||
# <code>[_SET_]</code>, <code>[^_SET_]</code> (<code>[!_SET_]</code>) ::
|
# <code>[_SET_]</code>, <code>[^_SET_]</code> (<code>[!_SET_]</code>) ::
|
||||||
# Matches any one character in _SET_. Behaves like character sets in
|
# Matches any one character in _SET_. Behaves like character sets in
|
||||||
# Regexp, including set negation (<code>[^a-z]</code>).
|
# Regexp, including set negation (<code>[^a-z]</code>).
|
||||||
#
|
#
|
||||||
# <code>{_A_,_B_}</code> ::
|
# <code>{_A_,_B_}</code> ::
|
||||||
|
|||||||
+1
-1
@@ -68,7 +68,7 @@ assert('Integer#%', '15.2.8.3.5') do
|
|||||||
d = 2%-5
|
d = 2%-5
|
||||||
e = -2%5
|
e = -2%5
|
||||||
f = -2%-5
|
f = -2%-5
|
||||||
g = 2%-2
|
g = 2%-2
|
||||||
h = -2%2
|
h = -2%2
|
||||||
i = -2%-2
|
i = -2%-2
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
# The aim of these tests is to detect pitfall for optimized VM.
|
# The aim of these tests is to detect pitfall for optimized VM.
|
||||||
|
|
||||||
# Test for or/and
|
# Test for or/and
|
||||||
#
|
#
|
||||||
|
|||||||
+3
-3
@@ -356,16 +356,16 @@ end
|
|||||||
assert('Module#method_defined?', '15.2.2.4.34') do
|
assert('Module#method_defined?', '15.2.2.4.34') do
|
||||||
module Test4MethodDefined
|
module Test4MethodDefined
|
||||||
module A
|
module A
|
||||||
def method1() end
|
def method1() end
|
||||||
end
|
end
|
||||||
|
|
||||||
class B
|
class B
|
||||||
def method2() end
|
def method2() end
|
||||||
end
|
end
|
||||||
|
|
||||||
class C < B
|
class C < B
|
||||||
include A
|
include A
|
||||||
def method3() end
|
def method3() end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user