Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
36844a1
Dir.chdir guards its block against other threads, and wants HOME or L…
Largo Nov 22, 2026
2168f1d
Dir.open keeps its encoding: without a block, and refuses other keywords
Largo Nov 22, 2026
70f0d24
Dir.glob drops a trailing backslash, and rereads an Array's length
Largo Nov 22, 2026
f2d4f29
Dir.home("") is the current user's home, and takes a name with to_str
Largo Nov 22, 2026
72d1c57
Array#join separates nested empty arrays and starts US-ASCII after an…
Largo Nov 22, 2026
20d6c9b
Array#rfind counts its arguments before answering an Enumerator
Largo Nov 22, 2026
0a9b62d
IO#gets keeps the characters of EUC-JP and Shift_JIS whole
Largo Nov 22, 2026
47f85dd
IO#gets refuses a separator in another encoding, and converts one it …
Largo Nov 22, 2026
8d30249
ENV refuses a name or value with a NUL or an ASCII-incompatible encoding
Largo Nov 22, 2026
cc15e35
UnboundMethod#bind names the class by its #to_s
Largo Nov 22, 2026
e003d0d
class X < nil is a TypeError, and so is inheriting an uninitialized c…
Largo Nov 22, 2026
203cfbf
An implicit conversion refuses a respond_to? that takes 3 arguments
Largo Nov 22, 2026
fd8cf99
(self).m is not a private call
Largo Nov 22, 2026
24953b8
Method#== is false for a Method that has a singleton method
Largo Nov 22, 2026
496e3e0
A method only respond_to_missing? vouches for is owned by the receive…
Largo Nov 22, 2026
aee4526
Kernel#singleton_method's NameError carries the name and receiver
Largo Nov 22, 2026
c41cdec
Method#inspect writes modules with #inspect and names a bound module'…
Largo Nov 22, 2026
0475f14
Regexp: [--0] is the range from '-' to '0'
Largo Nov 22, 2026
5b9f889
Regexp: \8 and \9 past the last group are the digits themselves
Largo Nov 22, 2026
6cf2a03
Regexp: \k<name> finds a group whose name .NET cannot spell
Largo Nov 22, 2026
d5982a7
Array, String and MatchData take a range end that fits in a long
Largo Nov 22, 2026
04d634b
Regexp#to_s and #inspect answer in the regexp's encoding
Largo Nov 22, 2026
33a03f9
Array#to_h hands a lambda block each pair as a plain block would
Largo Nov 22, 2026
849b46e
yield *[x] to a lambda passes x whole, as yield x does
Largo Nov 22, 2026
11bd734
Array range endpoints may be any long
Largo Nov 22, 2026
b01c11b
A trace_var handler that assigns its variable does not fire itself
Largo Nov 22, 2026
9403cde
Marshal.load says TypeError for a name that is no class, and checks _…
Largo Nov 22, 2026
ffc9d87
Marshal.load refuses an 'S' record for a class that is not a struct
Largo Nov 22, 2026
7f5e422
Marshal.load does not set instance variables on a class or module
Largo Nov 22, 2026
9a55ea4
Array#zip reaches #to_ary and #each through method_missing
Largo Nov 22, 2026
21d7e13
lf_newline, and newline decorators into UTF-16 and UTF-32
Largo Nov 22, 2026
6d41178
Encoding::Converter.new takes a conversion path, and a decorator by name
Largo Nov 22, 2026
74c9b87
String#encode reads broken UTF-16 and UTF-32 as CRuby does
Largo Nov 22, 2026
9e8e8e7
String#encode without a target replaces what does not convert
Largo Nov 22, 2026
2288448
Array#inspect and Hash#inspect take the encoding of the first item only
Largo Nov 22, 2026
8b23170
Finalizers run with interrupts held back, as in CRuby
Largo Nov 22, 2026
e089ba0
cruby-test: exclude TestGc#test_latest_gc_info_need_major_by
Largo Nov 22, 2026
4fe58c1
Marshal.dump's depth limit lets a string's encoding through
Largo Nov 22, 2026
faae22b
Marshal.dump raises when a _dump changes the array or hash being dumped
Largo Nov 22, 2026
b41ca8d
Marshal.load refuses a Bignum record with a negative length
Largo Nov 22, 2026
7c93c62
Marshal.load lets a symbol's instance variables link back to it
Largo Nov 22, 2026
7911178
Marshal keeps the ruby2_keywords flag of a Hash
Largo Nov 22, 2026
2defed4
Array#hash marks the elements whose #hash it calls
Largo Nov 22, 2026
15989d3
A name in a destructured block parameter shadows the outer local
Largo Nov 22, 2026
a0dd56c
#clone copies the singleton class of an object's singleton class
Largo Nov 22, 2026
ba0ee4c
A curried proc warns when a partial call is given a block
Largo Nov 22, 2026
2ff54c4
Method#to_proc#parameters of a core method is the method's
Largo Nov 22, 2026
2d93245
Proc#>> and #<< pass the keywords they are called with on
Largo Nov 22, 2026
2777db9
raise takes cause: out of other keywords and passes those on as a Hash
Largo Nov 22, 2026
6107982
$@ asks the exception's own #backtrace
Largo Nov 22, 2026
c5314e9
A write or a seek after #ungetc gives back the pushed-back bytes too
Largo Nov 22, 2026
9863a93
IO.copy_stream writes through its destination IO, and asks for #to_io…
Largo Nov 22, 2026
11db3cc
IO#readpartial converts its buffer with to_str
Largo Nov 22, 2026
fec956e
Queue and ConditionVariable have no #initialize_copy and no plain Mar…
Largo Nov 22, 2026
0f1233d
Encoding::Converter#primitive_convert refuses the source string as it…
Largo Nov 22, 2026
e928a44
Opening an ASCII-incompatible encoding for reading needs binmode
Largo Nov 22, 2026
929a63d
String#slice(//) checks the string and sets $~
Largo Nov 22, 2026
76b1973
String#[]= takes a range end that fits in a long
Largo Nov 22, 2026
f33b94e
spawn and exec raise EBADF for `fd => :close` when fd is not open
Largo Nov 22, 2026
df72c99
Dir_ChdirRelative1 silences the conflicting chdir warning
Largo Nov 22, 2026
fdd718f
Time's exact-number conversion sees delegators, and names the class b…
Largo Nov 22, 2026
dd00673
Time.utc ignores the seventh of eight arguments, and range-checks sec…
Largo Nov 22, 2026
502ced3
A UTC offset string uses colons throughout or not at all
Largo Nov 22, 2026
a7566ed
Time#initialize refuses a Time that is already initialized
Largo Nov 22, 2026
3a50aea
Time.new takes a date string with a zone and no time of day
Largo Nov 22, 2026
c215f58
Time._load reads Ruby 1.9.1's submicro, and carries month 13..16 into…
Largo Nov 22, 2026
118d076
Time#strftime warns about an empty format under -w
Largo Nov 22, 2026
b5b4006
Thread#join takes any Integer and #to_f, and a negative limit does no…
Largo Nov 22, 2026
13df117
Time#dst? asks a timezone object's #dst?
Largo Nov 22, 2026
7fdd3e6
IO#reopen takes File.open's options, and takes the other IO's encodings
Largo Nov 22, 2026
a0182fe
Module#using and #refine check where and how they are called as CRuby…
Largo Nov 22, 2026
66fc556
A refinement's method binds only to instances of the refined class
Largo Nov 22, 2026
106248a
Killing the main thread exits the program
Largo Nov 22, 2026
10535a2
Thread#inspect names a Thread subclass
Largo Nov 22, 2026
40cbad4
File.basename refuses a suffix in an ASCII-incompatible encoding
Largo Nov 22, 2026
0695acc
Marshal.dump takes an object's instance variables before writing any
Largo Nov 22, 2026
c766ce5
Marshal.load copies the data's instance variables onto a marshal_load…
Largo Nov 22, 2026
95d9db0
File#lstat describes the path the File was opened with
Largo Nov 22, 2026
c23a73f
File.expand_path leaves the base alone beside an absolute path
Largo Nov 22, 2026
5b4c369
File.open with a mode and a mode: option says "mode specified twice"
Largo Nov 22, 2026
71e6699
Marshal.dump(ARGF) is a TypeError, as in CRuby
Largo Nov 22, 2026
ef36b15
method_missing called with a name that is not a Symbol is an Argument…
Largo Nov 22, 2026
e63046a
Warning.warn names nil as nil and refuses an ASCII-incompatible message
Largo Nov 22, 2026
748b73f
eval of a string opening with a UTF-8 BOM reads it as UTF-8
Largo Nov 22, 2026
d0f8348
A magic comment naming "external" or "locale" is an invalid encoding
Largo Nov 22, 2026
c18b2eb
A new thread starts with its creator's handle_interrupt masks
Largo Nov 22, 2026
3355d69
Marshal keeps the modules prepended to an object's singleton class
Largo Nov 22, 2026
6f3ec68
Marshal.load(freeze: true) keeps an extended string's modules
Largo Nov 22, 2026
59eda39
An IO-like object's #read may answer more than it was asked for
Largo Nov 22, 2026
dca6df5
IO#gets and friends refuse a separator the IO's encoding cannot read
Largo Nov 22, 2026
36fc27e
IO.new takes its mode from the descriptor, and makes an adopted one c…
Largo Nov 22, 2026
6ecc36e
IO.pipe takes binmode: true
Largo Nov 22, 2026
c297c12
An IO's path belongs to the object, and follows it through #reopen
Largo Nov 22, 2026
9636544
IronRuby.Tests: Marshal_LoadChecks1, and Time_LoadZone1 follows the m…
Largo Nov 22, 2026
002a4fc
Thread#raise on the current thread respects Thread.handle_interrupt
Largo Nov 22, 2026
9af56d1
A masked Thread#raise does not end a sleep
Largo Nov 22, 2026
82cf3bd
A frozen ThreadGroup takes and gives up no thread
Largo Nov 22, 2026
03a6026
Merge branch 'claude/rts-c' into claude/ruby-test-suite-2
Largo Nov 22, 2026
3cf3f78
A timed sleep answers whether it was woken again
Largo Nov 22, 2026
42cfcd2
Merge branch 'claude/rts-d' into claude/ruby-test-suite-2
Largo Nov 22, 2026
105c8aa
Merge branch 'claude/rts-b' into claude/ruby-test-suite-2
Largo Nov 22, 2026
c7a6708
Merge branch 'claude/rts-e' into claude/ruby-test-suite-2
Largo Nov 22, 2026
3fd3566
Regexp: only a '-' bound of a range is spelled as a code unit
Largo Nov 22, 2026
acbe45f
IO#dup of IO.popen(cmd, "r+") keeps its write half
Largo Nov 22, 2026
0353f50
IO#ungetc and #ungetbyte refuse to push back past the read buffer
Largo Nov 22, 2026
60086dd
A frozen String gets a singleton class unless it is interned
Largo Nov 22, 2026
258bb2b
File::Stat can be allocated, copied and reinitialized
Largo Nov 22, 2026
96d0995
cruby-test runner loads tempfile, as CRuby's init.rb does
Largo Nov 22, 2026
e485005
Time, Thread#raise and two message helpers call through their runtime…
Largo Nov 22, 2026
51c4b29
Time.new converts precision: before it parses the string
Largo Nov 22, 2026
9e37288
Time#strftime raises ERANGE for a width it cannot hold
Largo Nov 22, 2026
7d95f95
Marshal.load reads an IO-like source no further than the dump
Largo Nov 22, 2026
1b8c229
String#undump finds the force_encoding form without a backtracking re…
Largo Nov 22, 2026
7546609
Prelude_AliasNames1 expects rfind(1, 2) to be an ArgumentError
Largo Nov 22, 2026
9219313
Merge branch 'worktree-agent-ada977294e34e91f3' into claude/ruby-test…
Largo Nov 22, 2026
3b3c459
Methods of a cloned class or module look constants up in the clone
Largo Nov 22, 2026
6ddd64e
A call of an undefined method_missing is answered as BasicObject's would
Largo Nov 22, 2026
07cce21
A library block breaking after its method returned is an unexpected b…
Largo Nov 22, 2026
c402e3e
An unknown magic comment encoding is reported with the line it is on
Largo Nov 22, 2026
30dab3f
yield x, **h with h empty does not auto-splat x for a block with opti…
Largo Nov 22, 2026
d943ca9
Method#super_method stops at a method made public by `public :m'
Largo Nov 22, 2026
0b2c7e7
Array#[], String#[] and their []= take an object that describes a range
Largo Nov 22, 2026
812428c
A local `it' that a block using `it' assigns is a variable of its own
Largo Nov 22, 2026
6572c8d
IO#fcntl works on the standard streams and raises fcntl(2)'s errno
Largo Nov 22, 2026
33cd296
A byte limit on #gets in UTF-16 or UTF-32 ends on a whole character
Largo Nov 22, 2026
089701c
File.open's Errno::EACCES names the path
Largo Nov 22, 2026
163ed52
File's instance methods work on an IO reopened to a File
Largo Nov 22, 2026
4ad2477
File.join reads its array as it goes and keeps fs_enc_check's encoding
Largo Nov 22, 2026
8d1294b
File.expand_path and File.absolute_path keep a path's bytes
Largo Nov 22, 2026
3314a04
Merge branch 'worktree-agent-a947b509fe1d7c0c4' into claude/ruby-test…
Largo Nov 22, 2026
8399660
IO.allocate's #write, #print and encodings raise "uninitialized stream"
Largo Nov 22, 2026
3026035
File#initialize refuses to reinitialize a File
Largo Nov 22, 2026
1224db2
IO#gets of a long line from a pipe waits for the rest of it
Largo Nov 22, 2026
a8f50bc
File.expand_path joins a relative path to its base without doubling a…
Largo Nov 22, 2026
d07288a
IO#gets with a limit counts the bytes of the converted line
Largo Nov 22, 2026
2eb180a
A buffered IO write delivers what handle_interrupt(:on_blocking) held…
Largo Nov 22, 2026
73cc182
Regexp literals and interpolations are preprocessed as MRI does
Largo Nov 22, 2026
7f3a8f2
A \p{...} property fixes a regexp's encoding
Largo Nov 22, 2026
f3310a7
A UTF-16/32 string of broken length keeps its bytes, and chomps as MR…
Largo Nov 22, 2026
f5db63d
Merge branch 'worktree-agent-ac9d7fc789373eaa3' into claude/ruby-test…
Largo Nov 22, 2026
8abaeb5
Merge branch 'worktree-agent-a10ecc223b53b23d4' into claude/ruby-test…
Largo Nov 22, 2026
084168c
File.join says "string contains null byte" for a NUL in a String argu…
Largo Nov 22, 2026
49e8b0d
Merge branch 'worktree-agent-a48bfa15073bf1f2e' into claude/ruby-test…
Largo Nov 22, 2026
858d4a5
Backtrace_AsciiLocalePaths1 compares the expanded path's bytes
Largo Nov 22, 2026
2f61e89
cruby-test: baseline after the second round of test/ruby fixes
Largo Nov 22, 2026
5f71bae
Merge origin/master into claude/ruby-test-suite-2
Largo Nov 22, 2026
f566fdc
SyntaxError_MessageLocation1 writes its bad magic comment in binary
Largo Nov 22, 2026
6c42fca
Dir.home: a user name whose #to_str gives no String is a TypeError
Largo Nov 22, 2026
c46987a
Method#owner of a respond_to_missing? method is the class it was made on
Largo Nov 23, 2026
bff4dba
UnboundMethod#bind checks the receiver against the method's #owner
Largo Nov 23, 2026
eea6341
Method#inspect lets an anonymous module's #inspect raise
Largo Nov 23, 2026
db5f740
Module#using in a string module_eval inside a method is refused
Largo Nov 23, 2026
11a8841
Thread sleep takes a raise parked between its check and the signal reset
Largo Nov 23, 2026
8ba129e
A cloned module's methods keep the refinements their def saw
Largo Nov 23, 2026
4af0c35
method_missing called directly sets the NoMethodError reason afresh
Largo Nov 23, 2026
368141f
Kernel#clone copies the instance variables of the singleton class's s…
Largo Nov 23, 2026
07d0353
An exception's singleton #backtrace is used where MRI uses it
Largo Nov 23, 2026
954049c
Merge branch 'worktree-agent-a427b7ba8ea73c26d' into claude/ruby-test…
Largo Nov 23, 2026
c62ebc6
Merge origin/master into claude/ruby-test-suite-2
Largo Nov 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Src/IronRuby.Tests/RubyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public Tests(Driver/*!*/ driver) {
MutableString_ConcatAscii2,
MutableString_SliceAppend1,
MutableString_SipHash1,
MutableString_WideBrokenLength1,
RubyArray_Ctors,
RubyArray_Basic,
RubyArray_Add,
Expand Down Expand Up @@ -206,6 +207,7 @@ public Tests(Driver/*!*/ driver) {
Regex_MatchStringClassAndIdentity1,
Regex_SharedTranslation1,
Regex_SharedTranslation2,
Regex_LiteralEncodings1,
Regex_PropertyEncoding1,
Regex_BinaryCtype1,
Regex_InspectResultEncoding1,
Expand Down Expand Up @@ -333,6 +335,7 @@ public Tests(Driver/*!*/ driver) {
Scenario_RubyProcYieldArgs2,
Scenario_RubyProcYieldArgs3,
Scenario_RubyProcYieldArgs4,
Scenario_RubyProcYieldArgs5,
Scenario_RubyProcCallArgs1,
Scenario_RubyProcCallArgs2A,
Scenario_RubyProcCallArgs2B,
Expand All @@ -343,6 +346,7 @@ public Tests(Driver/*!*/ driver) {
Scenario_RubyBlockArgs4B,
Scenario_RubyBlockArgs5,
Scenario_RubyBlockArgs6,
Scenario_RubyBlockArgs7,
Proc_RhsAndBlockArguments1,
Block_ProcParams1,

Expand Down Expand Up @@ -552,6 +556,7 @@ public Tests(Driver/*!*/ driver) {
Hooks3,
MethodLookupCacheFull1,
Hooks4,
TraceVar_AssignInHandler1,

ClrFields1,
ClrFields2,
Expand Down Expand Up @@ -763,6 +768,7 @@ public Tests(Driver/*!*/ driver) {
ClrClosedInterfaceExtensions2,
HostingDefaultOptions1,
HostingEncodingOption1,
HostingTimeSitesPerRuntime1,
Interactive1,
Interactive2,

Expand Down Expand Up @@ -850,6 +856,7 @@ public Tests(Driver/*!*/ driver) {
UndefMethodLookup3,
UndefMethodLookup4,
UndefMethodLookup6,
UndefMethodMissing1,
UndefCoreMethodWarnings1,
RemoveBasicObjectInitialize1,
MethodAdded1,
Expand All @@ -862,6 +869,7 @@ public Tests(Driver/*!*/ driver) {
Visibility4,
Visibility5,
Visibility6,
Visibility7,
VisibilityCaching1,
VisibilityCaching2,
DefineMethodVisibility1,
Expand Down Expand Up @@ -915,6 +923,7 @@ public Tests(Driver/*!*/ driver) {
SuperParameterless2B,
SuperParameterless3,
SuperParameterlessKeywordRest1,
SuperMethodForwarder1,
SuperKeywordSplat1,
SuperKeywordRestPassOn1,
SuperParameterlessKeywordRest2,
Expand Down Expand Up @@ -1031,6 +1040,7 @@ public Tests(Driver/*!*/ driver) {
Marshal_LoadFloat1,
Marshal_SetIVars1,
Marshal_NameError1,
Marshal_LoadChecks1,
Integer_SqrtPowDigits1,
Prelude_DataStructErrors1,
Prelude_AliasNames1,
Expand Down Expand Up @@ -1075,6 +1085,8 @@ public Tests(Driver/*!*/ driver) {
Io_LineReaders2,
Io_LineReaders3,
Io_UngetcConverted1,
Io_GetsLongLineFromPipe1,
Io_UnreadPushedBack1,
Io_WideLineReaders1,
Io_Timeout1,
Io_Timeout2,
Expand Down Expand Up @@ -1161,6 +1173,8 @@ public Tests(Driver/*!*/ driver) {
WeakMap_NoBlock1,
Fiber_ThreadRaiseReachesRunningFiber1,
Thread_HandleInterruptOtherRuntime1,
Thread_HandleInterruptInherited1,
Thread_HandleInterruptIoWrite1,
Thread_RaiseBetweenBlockCallsMeetsRescue1,
Thread_KillBehindRaise1,
Thread_KillBehindRescuedRaise1,
Expand Down Expand Up @@ -1190,6 +1204,9 @@ public Tests(Driver/*!*/ driver) {
PreludeKeywordsArity1,
LibraryKeywordsStored1,
BlockKeywordsPositional1,
YieldEmptyKeywordSplat1,
LibraryBlockOrphanBreak1,
ItParameterLocal1,
PreludeKeywordsYielder1,
SymbolProcKeywords1,
ToIntToStrConversion1,
Expand All @@ -1215,6 +1232,7 @@ public Tests(Driver/*!*/ driver) {
ClassDuplication7,
Clone1,
Dup1,
CloneConstantLookup1,
Structs1,
MetaModules1,
MetaModulesDuplication1,
Expand Down Expand Up @@ -1349,6 +1367,10 @@ public Tests(Driver/*!*/ driver) {
Array_Cycle1,
Range_Recursive1,
Array_JoinRecursive1,
Array_JoinNested1,
Array_RangeLongEnd1,
Array_DuckRangeIndex1,
Array_HashRecursiveElement1,
String_DumpNonUnicode1,
IO_PutsRecursiveToAry1,
Hash_MutateInBlock1,
Expand Down
112 changes: 112 additions & 0 deletions Src/IronRuby.Tests/Runtime/ArrayTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,118 @@ public void Array_JoinRecursive1() {
#<ArgumentError: recursive array join>
#<ArgumentError: recursive array join>
""12335""
");
}

/// <summary>
/// Array#hash marks every element whose #hash it calls, as MRI's rb_hash does: a Struct whose #hash hashes
/// an array holding another Struct that points back recursed until the stack overflowed ([Bug #9151]).
/// </summary>
public void Array_HashRecursiveElement1() {
TestOutput(@"
s = Struct.new(:x) { def hash; [x, ''].hash; end }
a = s.new; b = s.new; a.x = b; b.x = a
p a.hash == b.hash
h = {}; h[[a, 'hello']] = 1; h[[b, 'world']] = 2; p h.size
o = Object.new; p [o, o].hash == [o, o].hash
", @"
true
2
true
");
}

/// <summary>
/// A range endpoint that fits a long but not an int is a position past the end of any list (MRI's
/// rb_range_beg_len reads it with NUM2LONG), not a RangeError; CRuby's TestArray#test_range_with_len_max_end.
/// </summary>
public void Array_RangeLongEnd1() {
TestOutput(@"
max = 2**63 - 1
a = [1, 2]
p a[0..max], a[-1..max], a[max..], a[-max..1]
b = [1, 2, 3]; b[1..max] = 9; p b
b = [1, 2, 3]; p b.slice!(1..max), b
p(([1, 2].fill(0, 0..max) rescue $!))
p(([1, 2].values_at(0..max) rescue $!))
p((a[0..2**64] rescue $!))
", @"
[1, 2]
[2]
nil
nil
[1, 9]
[2, 3]
[1]
#<ArgumentError: argument too big>
#<IndexError: index 9223372036854775806 too big>
#<RangeError: bignum too big to convert into 'long'>
");
}

/// <summary>
/// MRI's rb_range_values: an index that is not a Range but has #begin, #end and #exclude_end? - private
/// ones too - reads and assigns as the Range it describes (Array#[], #[]=, String#[], #[]=, Symbol#[]).
/// </summary>
public void Array_DuckRangeIndex1() {
TestOutput(@"
class DuckRange
def initialize(b, e, x = false) = (@b, @e, @x = b, e, x)
def begin = @b
def end = @e
def exclude_end? = @x
end
p ""abcd""[DuckRange.new(1, 2)], ""abcd"".slice(DuckRange.new(1, 2, true)), :abcd[DuckRange.new(2, nil)]
p [1, 2, 3, 4][DuckRange.new(1, 2)], [1, 2, 3].values_at(DuckRange.new(0, 1))
a = [1, 2, 3]; a[DuckRange.new(0, 1)] = 9; p a
s = +""abcd""; s[DuckRange.new(0, 1)] = ""X""; p s
s = +""ab""; s[1] = ""Q""; s[1.5] = ""R""; p s
p((begin; [0][DuckRange.new(-10, 0)] = 1; rescue RangeError; $!.class; end))
o = Object.new
class << o; attr_accessor :begin, :end; end
p(([1][o] rescue $!))
def o.exclude_end? = false
o.begin = 0; o.end = 0
class << o; private :begin, :end; end
p [1][o]
", @"
""bc""
""b""
""cd""
[2, 3]
[1, 2]
[9, 3]
""Xcd""
""aR""
RangeError
#<TypeError: no implicit conversion of Object into Integer>
[1]
");
}

/// <summary>
/// Array#join separates the elements of nested arrays, empty ones included, and starts in US-ASCII when the
/// first element is an array, taking another encoding only from a string that is not ASCII (MRI's
/// ary_join_1_ary and rb_str_buf_append; CRuby's TestArray#test_join).
/// </summary>
public void Array_JoinNested1() {
TestOutput(@"
p [[], 1].join('-')
p [[[]], [], 1, [2, []]].join('-')
p [nil, 1, nil].join('-')
u = ''.force_encoding('UTF-8')
p [[], u, nil].join.encoding
p [[], ""\u3042"", nil].join.encoding
p [nil, u].join.encoding
p [u, [1]].join.encoding
", @"
""-1""
""--1-2-""
""-1-""
#<Encoding:US-ASCII>
#<Encoding:UTF-8>
#<Encoding:US-ASCII>
#<Encoding:UTF-8>
");
}
}
Expand Down
2 changes: 1 addition & 1 deletion Src/IronRuby.Tests/Runtime/BacktraceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ p dc.encoding
load File.join(t.b, dc, 'm.rb')
p [LIB, M].map(&:encoding), [LIB, M].all?(&:valid_encoding?)
p LIB.b.end_with?(""café/lib.rb"".b), M.b.include?(""café/m.rb:2"".b)
p File.expand_path('x', File.dirname(LIB)).end_with?(""café/x"")
p File.expand_path('x', File.dirname(LIB)).b.end_with?(""café/x"".b)
ensure
Encoding.default_external = old
end
Expand Down
Loading
Loading