ruby-changes:41477
From: hsbt <ko1@a...>
Date: Sat, 16 Jan 2016 10:37:17 +0900 (JST)
Subject: [ruby-changes:41477] hsbt:r53551 (trunk): * common.mk: test-sample was changed to test-basic.
hsbt 2016-01-16 10:37:47 +0900 (Sat, 16 Jan 2016) New Revision: 53551 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53551 Log: * common.mk: test-sample was changed to test-basic. [Feature #11982][ruby-core:72823] * basictest/runner.rb: ditto. rename from tool/rubytest.rb. * basictest/test.rb: ditto. rename from sample/test.rb. * defs/gmake.mk: picked from r53540 * sample/test.rb: backword compatibility for chkbuild. Added files: trunk/basictest/runner.rb trunk/basictest/test.rb Removed files: trunk/tool/rubytest.rb Modified files: trunk/ChangeLog trunk/common.mk trunk/defs/gmake.mk trunk/sample/test.rb Index: defs/gmake.mk =================================================================== --- defs/gmake.mk (revision 53550) +++ defs/gmake.mk (revision 53551) @@ -41,12 +41,13 @@ $(foreach arch,$(filter -arch=%,$(subst https://github.com/ruby/ruby/blob/trunk/defs/gmake.mk#L41 endif ifneq ($(filter $(CHECK_TARGETS) test,$(MAKECMDGOALS)),) +yes-test-basic: $(TEST_DEPENDS) yes-test-knownbug yes-test-knownbug: $(TEST_DEPENDS) yes-btest-ruby -yes-btest-ruby: $(TEST_DEPENDS) yes-test-sample -yes-test-sample: $(TEST_DEPENDS) +yes-btest-ruby: $(TEST_DEPENDS) endif -ifneq ($(filter $(CHECK_TARGETS),$(MAKECMDGOALS)) $(filter test-all,$(TEST_TARGETS)),) -yes-test-testframework yes-test-almost yes-test-ruby: $(filter-out %test-all %test-ruby check%,$(TEST_TARGETS)) +ifneq ($(filter $(CHECK_TARGETS),$(MAKECMDGOALS)) $(filter yes-test-all,$(TEST_TARGETS)),) +yes-test-testframework yes-test-almost yes-test-ruby: $(filter-out %test-all %test-ruby check%,$(TEST_TARGETS)) \ + yes-test-basic endif ifneq ($(filter $(CHECK_TARGETS),$(MAKECMDGOALS))$(if $(filter test-all,$(MAKECMDGOALS)),$(filter test-knownbug,$(MAKECMDGOALS))),) yes-test-testframework yes-test-almost yes-test-ruby: yes-test-knownbug Index: sample/test.rb =================================================================== --- sample/test.rb (revision 53550) +++ sample/test.rb (revision 53551) @@ -1,2369 +1,2 @@ https://github.com/ruby/ruby/blob/trunk/sample/test.rb#L1 -#! /usr/bin/env ruby -# -*- coding: us-ascii -*- - -$testnum=0 -$ntest=0 -$failed = 0 -class Progress - def initialize - @color = nil - @tty = nil - @quiet = nil - @verbose = nil - ARGV.each do |arg| - case arg - when /\A--color(?:=(?:always|(auto)|(never)|(.*)))?\z/ - warn "unknown --color argument: #$3" if $3 - @color = $1 ? nil : !$2 - when /\A--tty(=(?:yes|(no)|(.*)))?\z/ - warn "unknown --tty argument: #$3" if $3 - @tty = !$1 || !$2 - true - when /\A-(q|-quiet)\z/ - @quiet = true - when /\A-(v|-verbose)\z/ - @verbose = true - end - end - @tty = STDERR.tty? && !STDOUT.tty? && /dumb/ !~ ENV["TERM"] if @tty.nil? - @eol = @tty && !@verbose ? "\r\e[K\r" : "\n" - case @color - when nil - @color = @tty - end - if @color - # dircolors-like style - colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {} - begin - File.read(File.join(__dir__, "../test/colors")).scan(/(\w+)=([^:\n]*)/) do |n, c| - colors[n] ||= c - end - rescue - end - @passed = "\e[;#{colors["pass"] || "32"}m" - @failed = "\e[;#{colors["fail"] || "31"}m" - @reset = "\e[m" - else - @passed = @failed = @reset = "" - end - extend(Rotator) if @tty - end - - def passed_string - "." - end - def failed_string - "#{@failed}F#{@reset}" - end - def init_string - end - def finish_string - if @quiet - @eol - else - "#{@passed}#{@ok ? 'OK' : ''} #{$testnum}#{@reset}#{@eol}" - end - end - def pass - STDERR.print passed_string - end - def fail - @ok = false - STDERR.print failed_string - end - def init - @ok = true - STDERR.print init_string - end - def finish - STDERR.print finish_string - end - - module Rotator - ROTATOR = %w[- \\ | /] - BS = "\b" * ROTATOR[0].size - def passed_string - "#{BS}#{ROTATOR[(@count += 1) % ROTATOR.size]}" - end - def failed_string - "#{BS}#{super}#{ROTATOR[@count % ROTATOR.size]}" - end - def init_string - @count = 0 - " " - end - def finish_string - s = "#{BS}#{' ' * BS.size}#{BS}#{super}" - s.gsub!(/\n/, "\r\e[2K\r") if @quiet - s - end - end -end -PROGRESS = Progress.new - -def test_check(what) - unless $ntest.zero? - PROGRESS.finish - end - STDERR.print "sample/test.rb:#{what} " - PROGRESS.init - $what = what - $testnum = 0 -end - -def test_ok(cond,n=1) - $testnum+=1 - $ntest+=1 - where = (st = caller(n)) ? st[0] : "caller error! (n=#{n}, trace=#{caller(0).join(', ')}" - if cond - PROGRESS.pass - printf "ok %d (%s)\n", $testnum, where - else - PROGRESS.fail - printf "not ok %s %d -- %s\n", $what, $testnum, where - $failed+=1 - end - STDOUT.flush - STDERR.flush -end - -# make sure conditional operators work - -test_check "assignment" - -a=[]; a[0] ||= "bar"; -test_ok(a[0] == "bar") -h={}; h["foo"] ||= "bar"; -test_ok(h["foo"] == "bar") - -aa = 5 -aa ||= 25 -test_ok(aa == 5) -bb ||= 25 -test_ok(bb == 25) -cc &&=33 -test_ok(cc == nil) -cc = 5 -cc &&=44 -test_ok(cc == 44) - -a = nil; test_ok(a == nil) -a = 1; test_ok(a == 1) -a = []; test_ok(a == []) -a = [1]; test_ok(a == [1]) -a = [nil]; test_ok(a == [nil]) -a = [[]]; test_ok(a == [[]]) -a = [1,2]; test_ok(a == [1,2]) -a = [*[]]; test_ok(a == []) -a = [*[1]]; test_ok(a == [1]) -a = [*[1,2]]; test_ok(a == [1,2]) - -a = *[]; test_ok(a == []) -a = *[1]; test_ok(a == [1]) -a = *[nil]; test_ok(a == [nil]) -a = *[[]]; test_ok(a == [[]]) -a = *[1,2]; test_ok(a == [1,2]) -a = *[*[]]; test_ok(a == []) -a = *[*[1]]; test_ok(a == [1]) -a = *[*[1,2]]; test_ok(a == [1,2]) - -a, = nil; test_ok(a == nil) -a, = 1; test_ok(a == 1) -a, = []; test_ok(a == nil) -a, = [1]; test_ok(a == 1) -a, = [nil]; test_ok(a == nil) -a, = [[]]; test_ok(a == []) -a, = 1,2; test_ok(a == 1) -a, = [1,2]; test_ok(a == 1) -a, = [*[]]; test_ok(a == nil) -a, = [*[1]]; test_ok(a == 1) -a, = *[1,2]; test_ok(a == 1) -a, = [*[1,2]]; test_ok(a == 1) - -a, = *[]; test_ok(a == nil) -a, = *[1]; test_ok(a == 1) -a, = *[nil]; test_ok(a == nil) -a, = *[[]]; test_ok(a == []) -a, = *[1,2]; test_ok(a == 1) -a, = *[*[]]; test_ok(a == nil) -a, = *[*[1]]; test_ok(a == 1) -a, = *[*[1,2]]; test_ok(a == 1) - -*a = nil; test_ok(a == [nil]) -*a = 1; test_ok(a == [1]) -*a = []; test_ok(a == []) -*a = [1]; test_ok(a == [1]) -*a = [nil]; test_ok(a == [nil]) -*a = [[]]; test_ok(a == [[]]) -*a = [1,2]; test_ok(a == [1,2]) -*a = [*[]]; test_ok(a == []) -*a = [*[1]]; test_ok(a == [1]) -*a = [*[1,2]]; test_ok(a == [1,2]) - -*a = *[]; test_ok(a == []) -*a = *[1]; test_ok(a == [1]) -*a = *[nil]; test_ok(a == [nil]) -*a = *[[]]; test_ok(a == [[]]) -*a = *[1,2]; test_ok(a == [1,2]) -*a = *[*[]]; test_ok(a == []) -*a = *[*[1]]; test_ok(a == [1]) -*a = *[*[1,2]]; test_ok(a == [1,2]) - -a,b,*c = nil; test_ok([a,b,c] == [nil,nil,[]]) -a,b,*c = 1; test_ok([a,b,c] == [1,nil,[]]) -a,b,*c = []; test_ok([a,b,c] == [nil,nil,[]]) -a,b,*c = [1]; test_ok([a,b,c] == [1,nil,[]]) -a,b,*c = [nil]; test_ok([a,b,c] == [nil,nil,[]]) -a,b,*c = [[]]; test_ok([a,b,c] == [[],nil,[]]) -a,b,*c = [1,2]; test_ok([a,b,c] == [1,2,[]]) -a,b,*c = [*[]]; test_ok([a,b,c] == [nil,nil,[]]) -a,b,*c = [*[1]]; test_ok([a,b,c] == [1,nil,[]]) -a,b,*c = [*[1,2]]; test_ok([a,b,c] == [1,2,[]]) - -a,b,*c = *[]; test_ok([a,b,c] == [nil,nil,[]]) -a,b,*c = *[1]; test_ok([a,b,c] == [1,nil,[]]) -a,b,*c = *[nil]; test_ok([a,b,c] == [nil,nil,[]]) -a,b,*c = *[[]]; test_ok([a,b,c] == [[],nil,[]]) -a,b,*c = *[1,2]; test_ok([a,b,c] == [1,2,[]]) -a,b,*c = *[*[]]; test_ok([a,b,c] == [nil,nil,[]]) -a,b,*c = *[*[1]]; test_ok([a,b,c] == [1,nil,[]]) -a,b,*c = *[*[1,2]]; test_ok([a,b,c] == [1,2,[]]) - -def f; yield nil; end; f {|a| test_ok(a == nil)} -def f; yield 1; end; f {|a| test_ok(a == 1)} -def f; yield []; end; f {|a| test_ok(a == [])} -def f; yield [1]; end; f {|a| test_ok(a == [1])} -def f; yield [nil]; end; f {|a| test_ok(a == [nil])} -def f; yield [[]]; end; f {|a| test_ok(a == [[]])} -def f; yield [*[]]; end; f {|a| test_ok(a == [])} -def f; yield [*[1]]; end; f {|a| test_ok(a == [1])} -def f; yield [*[1,2]]; end; f {|a| test_ok(a == [1,2])} -def f; yield *[]; end; f {|a| test_ok(a == nil)} -def f; yield *[1]; end; f {|a| test_ok(a == 1)} -def f; yield *[nil]; end; f {|a| test_ok(a == nil)} -def f; yield *[[]]; end; f {|a| test_ok(a == [])} -def f; yield *[*[]]; end; f {|a| test_ok(a == nil)} -def f; yield *[*[1]]; end; f {|a| test_ok(a == 1)} -def f; yield *[*[1,2]]; end; f {|a| test_ok(a == 1)} - -def f; yield; end; f {|a,| test_ok(a == nil)} -def f; yield nil; end; f {|a,| test_ok(a == nil)} -def f; yield 1; end; f {|a,| test_ok(a == 1)} -def f; yield []; end; f {|a,| test_ok(a == nil)} -def f; yield [1]; end; f {|a,| test_ok(a == 1)} -def f; yield [nil]; end; f {|a,| test_ok(a == nil)} -def f; yield [[]]; end; f {|a,| test_ok(a == [])} -def f; yield [*[]]; end; f {|a,| test_ok(a == nil)} -def f; yield [*[1]]; end; f {|a,| test_ok(a == 1)} -def f; yield [*[1,2]]; end; f {|a,| test_ok(a == 1)} - -def f; yield *[]; end; f {|a,| test_ok(a == nil)} -def f; yield *[1]; end; f {|a,| test_ok(a == 1)} -def f; yield *[nil]; end; f {|a,| test_ok(a == nil)} -def f; yield *[[]]; end; f {|a,| test_ok(a == nil)} -def f; yield *[*[]]; end; f {|a,| test_ok(a == nil)} -def f; yield *[*[1]]; end; f {|a,| test_ok(a == 1)} -def f; yield *[*[1,2]]; end; f {|a,| test_ok(a == 1)} - -def f; yield; end; f {|*a| test_ok(a == [])} -def f; yield nil; end; f {|*a| test_ok(a == [nil])} -def f; yield 1; end; f {|*a| test_ok(a == [1])} -def f; yield []; end; f {|*a| test_ok(a == [[]])} -def f; yield [1]; end; f {|*a| test_ok(a == [[1]])} -def f; yield [nil]; end; f {|*a| test_ok(a == [[nil]])} -def f; yield [[]]; end; f {|*a| test_ok(a == [[[]]])} -def f; yield [1,2]; end; f {|*a| test_ok(a == [[1,2]])} -def f; yield [*[]]; end; f {|*a| test_ok(a == [[]])} -def f; yield [*[1]]; end; f {|*a| test_ok(a == [[1]])} -def f; yield [*[1,2]]; end; f {|*a| test_ok(a == [[1,2]])} - -def f; yield *[]; end; f {|*a| test_ok(a == [])} -def f; yield *[1]; end; f {|*a| test_ok(a == [1])} -def f; yield *[nil]; end; f {|*a| test_ok(a == [nil])} -def f; yield *[[]]; end; f {|*a| test_ok(a == [[]])} -def f; yield *[*[]]; end; f {|*a| test_ok(a == [])} -def f; yield *[*[1]]; end; f {|*a| test_ok(a == [1])} -def f; yield *[*[1,2]]; end; f {|*a| test_ok(a == [1,2])} - -def f; yield; end; f {|a,b,*c| test_ok([a,b,c] == [nil,nil,[]])} -def f; yield nil; end; f {|a,b,*c| test_ok([a,b,c] == [nil,nil,[]])} -def f; yield 1; end; f {|a,b,*c| test_ok([a,b,c] == [1,nil,[]])} -def f; yield []; end; f {|a,b,*c| test_ok([a,b,c] == [nil,nil,[]])} -def f; yield [1]; end; f {|a,b,*c| test_ok([a,b,c] == [1,nil,[]])} -def f; yield [nil]; end; f {|a,b,*c| test_ok([a,b,c] == [nil,nil,[]])} -def f; yield [[]]; end; f {|a,b,*c| test_ok([a,b,c] == [[],nil,[]])} -def f; yield [*[]]; end; f {|a,b,*c| test_ok([a,b,c] == [nil,nil,[]])} -def f; yield [*[1]]; end; f {|a,b,*c| test_ok([a,b,c] == [1,nil,[]])} -def f; yield [*[1,2]]; end; f {|a,b,*c| test_ok([a,b,c] == [1,2,[]])} - -def f; yield *[]; end; f {|a,b,*c| test_ok([a,b,c] == [nil,nil,[]])} -def f; yield *[1]; end; f {|a,b,*c| test_ok([a,b,c] == [1,nil,[]])} -def f; yield *[nil]; end; f {|a,b,*c| test_ok([a,b,c] == [nil,nil,[]])} -def f; yield *[[]]; end; f {|a,b,*c| test_ok([a,b,c] == [nil,nil,[]])} -def f; yield *[*[]]; end; f {|a,b,*c| test_ok([a,b,c] == [nil,nil,[]])} -def f; yield *[*[1]]; end; f {|a,b,*c| test_ok([a,b,c] == [1,nil,[]])} -def f; yield *[*[1,2]]; end; f {|a,b,*c| test_ok([a,b,c] == [1,2,[]])} - -def r; return; end; a = r(); test_ok(a == nil) -def r; return nil; end; a = r(); test_ok(a == nil) -def r; return 1; end; a = r(); test_ok(a == 1) -def r; return []; end; a = r(); test_ok(a == []) -def r; return [1]; end; a = r(); test_ok(a == [1]) -def r; return [nil]; end; a = r(); test_ok(a == [nil]) -def r; return [[]]; end; a = r(); test_ok(a == [[]]) -def r; return [*[]]; end; a = r(); test_ok(a == []) -def r; return [*[1]]; end; a = r(); test_ok(a == [1]) -def r; return [*[1,2]]; end; a = r(); test_ok(a == [1,2]) - -def r; return *[]; end; a = r(); test_ok(a == []) -def r; return *[1]; end; a = r(); test_ok(a == [1]) -def r; return *[nil]; end; a = r(); test_ok(a == [nil]) -def r; return *[[]]; end; a = r(); test_ok(a == [[]]) -def r; return *[*[]]; end; a = r(); test_ok(a == []) -def r; return *[*[1]]; end; a = r(); test_ok(a == [1]) -def r; return *[*[1,2]]; end; a = r(); test_ok(a == [1,2]) - -def r; return *[[]]; end; a = *r(); test_ok(a == [[]]) -def r; return *[*[1,2]]; end; a = *r(); test_ok(a == [1,2]) - -def r; return; end; *a = r(); test_ok(a == [nil]) -def r; return nil; end; *a = r(); test_ok(a == [nil]) -def r; return 1; end; *a = r(); test_ok(a == [1]) -def r; return []; end; *a = r(); test_ok(a == []) -def r; return [1]; end; *a = r(); test_ok(a == [1]) -def r; return [nil]; end; *a = r(); test_ok(a == [nil]) -def r; return [[]]; end; *a = r(); test_ok(a == [[]]) -def r; return [1,2]; end; *a = r(); test_ok(a == [1,2]) -def r; return [*[]]; end; *a = r(); test_ok(a == []) -def r; return [*[1]]; end; *a = r(); test_ok(a == [1]) -def r; return [*[1,2]]; end; *a = r(); test_ok(a == [1,2]) - -def r; return *[]; end; *a = r(); test_ok(a == []) -def r; return *[1]; end; *a = r(); test_ok(a == [1]) -def r; return *[nil]; end; *a = r(); test_ok(a == [nil]) -def r; return *[[]]; end; *a = r(); test_ok(a == [[]]) -def r; return *[1,2]; end; *a = r(); test_ok(a == [1,2]) -def r; return *[*[]]; end; *a = r(); test_ok(a == []) -def r; return *[*[1]]; end; *a = r(); test_ok(a == [1]) -def r; return *[*[1,2]]; end; *a = r(); test_ok(a == [1,2]) - -def r; return *[[]]; end; *a = *r(); test_ok(a == [[]]) -def r; return *[1,2]; end; *a = *r(); test_ok(a == [1,2]) -def r; return *[*[1,2]]; end; *a = *r(); test_ok(a == [1,2]) - -def r; return; end; a,b,*c = r(); test_ok([a,b,c] == [nil,nil,[]]) -def r; return nil; end; a,b,*c = r(); test_ok([a,b,c] == [nil,nil,[]]) -def r; return 1; end; a,b,*c = r(); test_ok([a,b,c] == [1,nil,[]]) -def r; return []; end; a,b,*c = r(); test_ok([a,b,c] == [nil,nil,[]]) -def r; return [1]; end; a,b,*c = r(); test_ok([a,b,c] == [1,nil,[]]) -def r; return [nil]; end; a,b,*c = r(); test_ok([a,b,c] == [nil,nil,[]]) -def r; return [[]]; end; a,b,*c = r(); test_ok([a,b,c] == [[],nil,[]]) -def r; return [1,2]; end; a,b,*c = r(); test_ok([a,b,c] == [1,2,[]]) -def r; return [*[]]; end; a,b,*c = r(); test_ok([a,b,c] == [nil,nil,[]]) -def r; return [*[1]]; end; a,b,*c = r(); test_ok([a,b,c] == [1,nil,[]]) -def r; return [*[1,2]]; end; a,b,*c = r(); test_ok([a,b,c] == [1,2,[]]) - -def r; return *[]; end; a,b,*c = r(); test_ok([a,b,c] == [nil,nil,[]]) -def r; return *[1]; end; a,b,*c = r(); test_ok([a,b,c] == [1,nil,[]]) -def r; return *[nil]; end; a,b,*c = r(); test_ok([a,b,c] == [nil,nil,[]]) -def r; return *[[]]; end; a,b,*c = r(); test_ok([a,b,c] == [[],nil,[]]) -def r; return *[1,2]; end; a,b,*c = r(); test_ok([a,b,c] == [1,2,[]]) -def r; return *[*[]]; end; a,b,*c = r(); test_ok([a,b,c] == [nil,nil,[]]) -def r; return *[*[1]]; end; a,b,*c = r(); test_ok([a,b,c] == [1,nil,[]]) -def r; return *[*[1,2]]; end; a,b,*c = r(); test_ok([a,b,c] == [1,2,[]]) - -f = lambda {|r,| test_ok([] == r)} -f.call([], *[]) - -f = lambda {|r,*l| test_ok([] == r); test_ok([1] == l)} -f.call([], *[1]) - -f = lambda{|x| x} -test_ok(f.call(42) == 42) -test_ok(f.call([42]) == [42]) -test_ok(f.call([[42]]) == [[42]]) -test_ok(f.call([42,55]) == [42,55]) - -f = lambda{|x,| x} -test_ok(f.call(42) == 42) -test_ok(f.call([42]) == [42]) -test_ok(f.call([[42]]) == [[42]]) -test_ok(f.call([42,55]) == [42,55]) - -f = lambda{|*x| x} -test_ok(f.call(42) == [42]) -test_ok(f.call([42]) == [[42]]) -test_ok(f.call([[42]]) == [[[42]]]) -test_ok(f.call([42,55]) == [[42,55]]) -test_ok(f.call(42,55) == [42,55]) - -f = lambda { |a, b=42, *c| [a,b,c] } -test_ok(f.call(1 ) == [1,42,[ ]] ) -test_ok(f.call(1,43 ) == [1,43,[ ]] ) -test_ok(f.call(1,43,44) == [1,43,[44]] ) - -f = lambda { |a, b=(a|16), *c, &block| [a,b,c,block&&block[]] } -test_ok(f.call(8 ) == [8,24,[ ],nil] ) -test_ok(f.call(8,43 ) == [8,43,[ ],nil] ) -test_ok(f.call(8,43,44) == [8,43,[44],nil] ) -test_ok(f.call(8 ){45} == [8,24,[ ],45 ] ) -test_ok(f.call(8,43 ){45} == [8,43,[ ],45 ] ) -test_ok(f.call(8,43,44){45} == [8,43,[44],45 ] ) - -f = lambda { |a, b=42, *c, d| [a,b,c,d] } -test_ok(f.call(1 ,99) == [1,42,[ ],99] ) -test_ok(f.call(1,43 ,99) == [1,43,[ ],99] ) -test_ok(f.call(1,43,44,99) == [1,43,[44],99] ) - -f = lambda { |a, b=(a|16), &block| [a,b,block&&block[]] } -test_ok(f.call(8 ) == [8,24,nil] ) -test_ok(f.call(8,43) == [8,43,nil] ) -test_ok(f.call(8,43) == [8,43,nil] ) -test_ok(f.call(8 ){45} == [8,24,45 ] ) -test_ok(f.call(8,43){45} == [8,43,45 ] ) -test_ok(f.call(8,43){45} == [8,43,45 ] ) - -f = lambda { |a, b=42, d| [a,b,d] } -test_ok(f.call(1 ,99) == [1,42,99] ) -test_ok(f.call(1,43,99) == [1,43,99] ) -test_ok(f.call(1,43,99) == [1,43,99] ) - -f = lambda { |b=42, *c, &block| [b,c,block&&block[]] } -test_ok(f.call( ) == [42,[ ],nil] ) -test_ok(f.call(43 ) == [43,[ ],nil] ) -test_ok(f.call(43,44) == [43,[44],nil] ) -test_ok(f.call( ){45} == [42,[ ],45 ] ) -test_ok(f.call(43 ){45} == [43,[ ],45 ] ) -test_ok(f.call(43,44){45} == [43,[44],45 ] ) - -f = lambda { |b=42, *c, d| [b,c,d] } -test_ok(f.call( 99) == [42,[ ],99] ) -test_ok(f.call(43 ,99) == [43,[ ],99] ) -test_ok(f.call(43,44,99) == [43,[44],99] ) - -f = lambda { |b=42, &block| [b,block&&block[]] } -test_ok(f.call( ) == [42,nil] ) -test_ok(f.call(43) == [43,nil] ) -test_ok(f.call(43) == [43,nil] ) -test_ok(f.call( ){45} == [42,45 ] ) -test_ok(f.call(43){45} == [43,45 ] ) -test_ok(f.call(43){45} == [43,45 ] ) - -f = lambda { |b=42, d| [b,d] } -test_ok(f.call( 99) == [42,99] ) -test_ok(f.call(43,99) == [43,99] ) -test_ok(f.call(43,99) == [43,99] ) - - -a,=*[1] -test_ok(a == 1) -a,=*[[1]] -test_ok(a == [1]) -a,=*[[[1]]] -test_ok(a == [[1]]) - -x, (y, z) = 1, 2, 3 -test_ok([1,2,nil] == [x,y,z]) -x, (y, z) = 1, [2,3] -test_ok([1,2,3] == [x,y,z]) -x, (y, z) = 1, [2] -test_ok([1,2,nil] == [x,y,z]) - -a = loop do break; end; test_ok(a == nil) -a = loop do break nil; end; test_ok(a == nil) -a = loop do break 1; end; test_ok(a == 1) -a = loop do break []; end; test_ok(a == []) -a = loop do break [1]; end; test_ok(a == [1]) -a = loop do break [nil]; end; test_ok(a == [nil]) -a = loop do break [[]]; end; test_ok(a == [[]]) -a = loop do break [*[]]; end; test_ok(a == []) -a = loop do break [*[1]]; end; test_ok(a == [1]) -a = loop do break [*[1,2]]; end; test_ok(a == [1,2]) - -a = loop do break *[]; end; test_ok(a == []) -a = loop do break *[1]; end; test_ok(a == [1]) -a = loop do break *[nil]; end; test_ok(a == [nil]) -a = loop do break *[[]]; end; test_ok(a == [[]]) -a = loop do break *[*[]]; end; test_ok(a == []) -a = loop do break *[*[1]]; end; test_ok(a == [1]) -a = loop do break *[*[1,2]]; end; test_ok(a == [1,2]) - -*a = loop do break; end; test_ok(a == [nil]) -*a = loop do break nil; end; test_ok(a == [nil]) -*a = loop do break 1; end; test_ok(a == [1]) -*a = loop do break []; end; test_ok(a == []) -*a = loop do break [1]; end; test_ok(a == [1]) -*a = loop do break [nil]; end; test_ok(a == [nil]) -*a = loop do break [[]]; end; test_ok(a == [[]]) -*a = loop do break [1,2]; end; test_ok(a == [1,2]) -*a = loop do break [*[]]; end; test_ok(a == []) -*a = loop do break [*[1]]; end; test_ok(a == [1]) -*a = loop do break [*[1,2]]; end; test_ok(a == [1,2]) - -*a = loop do break *[]; end; test_ok(a == []) -*a = loop do break *[1]; end; test_ok(a == [1]) -*a = loop do break *[nil]; end; test_ok(a == [nil]) -*a = loop do break *[[]]; end; test_ok(a == [[]]) -*a = loop do break *[1,2]; end; test_ok(a == [1,2]) -*a = loop do break *[*[]]; end; test_ok(a == []) -*a = loop do break *[*[1]]; end; test_ok(a == [1]) -*a = loop do break *[*[1,2]]; end; test_ok(a == [1,2]) - -*a = *loop do break *[[]]; end; test_ok(a == [[]]) -*a = *loop do break *[1,2]; end; test_ok(a == [1,2]) -*a = *loop do break *[*[1,2]]; end; test_ok(a == [1,2]) - -a,b,*c = loop do break; end; test_ok([a,b,c] == [nil,nil,[]]) -a,b,*c = loop do break nil; end; test_ok([a,b,c] == [nil,nil,[]]) -a,b,*c = loop do break 1; end; test_ok([a,b,c] == [1,nil,[]]) -a,b,*c = loop do break []; end; test_ok([a,b,c] == [nil,nil,[]]) -a,b,*c = loop do break [1]; en (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/