edit: $/Dev10/feature/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/core/kernel/eval_spec.rb;C1473028 File: eval_spec.rb =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/core/kernel/eval_spec.rb;C1473028 (server) 2/17/2010 11:16 AM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/core/kernel/eval_spec.rb;r187 @@ -282,8 +282,13 @@ x.should == 42 end end + + it "allows any string as a filename" do + some_string = "some string\r\n!?" + eval("raise 'hi' rescue $!", nil, some_string).backtrace.join("\n").should =~ /#{Regexp.escape(some_string)}/ + end end - + describe "Kernel.eval" do # TODO: This is how MRI 1.9 and JRuby behave. Bug or feature? # it "yields to the block of the method when evaling 'yield' inside it" do =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs;C1589426 File: Initializers.Generated.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs;C1589426 (server) 2/16/2010 9:40 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs;r187 @@ -616,6 +616,11 @@ module.HideMethod("<="); module.HideMethod(">"); module.HideMethod(">="); + DefineLibraryMethod(module, "fdiv", 0xbe0051, + 0x00000002U, + new Func(IronRuby.Builtins.BignumOps.FDiv) + ); + DefineLibraryMethod(module, "size", 0x51, 0x00000000U, new Func(IronRuby.Builtins.BignumOps.Size) @@ -1817,6 +1822,11 @@ private static void LoadFixnum_Instance(IronRuby.Builtins.RubyModule/*!*/ module) { LoadIronRuby__Clr__Integer_Instance(module); + DefineLibraryMethod(module, "fdiv", 0xbe0051, + 0x00010000U, + new Func(IronRuby.Builtins.Int32Ops.FDiv) + ); + DefineLibraryMethod(module, "id2name", 0x51, 0x00000000U, new Func(IronRuby.Builtins.Int32Ops.Id2Name) @@ -3692,11 +3702,11 @@ ); DefineLibraryMethod(module, "puts", 0x52, - 0x00000004U, 0x80000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000004U, 0x80000000U, 0x00000000U, + new Action, IronRuby.Runtime.ConversionStorage, System.Object, System.Object>(IronRuby.Builtins.KernelOps.PutString), new Action(IronRuby.Builtins.KernelOps.PutString), new Action, IronRuby.Runtime.ConversionStorage, System.Object, System.Object[]>(IronRuby.Builtins.KernelOps.PutString), - new Action(IronRuby.Builtins.KernelOps.PutsEmptyLine), - new Action, IronRuby.Runtime.ConversionStorage, System.Object, System.Object>(IronRuby.Builtins.KernelOps.PutString) + new Action(IronRuby.Builtins.KernelOps.PutsEmptyLine) ); DefineLibraryMethod(module, "raise", 0x52, @@ -3816,6 +3826,11 @@ new Func(IronRuby.Builtins.KernelOps.Tainted) ); + DefineLibraryMethod(module, "tap", 0xbb0051, + 0x00000002U, + new Func(IronRuby.Builtins.KernelOps.Tap) + ); + DefineLibraryMethod(module, "test", 0x52, 0x00040008U, 0x000c0018U, new Func(IronRuby.Builtins.KernelOps.Test), @@ -4057,11 +4072,11 @@ ); DefineLibraryMethod(module, "puts", 0x61, - 0x00000004U, 0x80000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000004U, 0x80000000U, 0x00000000U, + new Action, IronRuby.Runtime.ConversionStorage, System.Object, System.Object>(IronRuby.Builtins.KernelOps.PutString), new Action(IronRuby.Builtins.KernelOps.PutString), new Action, IronRuby.Runtime.ConversionStorage, System.Object, System.Object[]>(IronRuby.Builtins.KernelOps.PutString), - new Action(IronRuby.Builtins.KernelOps.PutsEmptyLine), - new Action, IronRuby.Runtime.ConversionStorage, System.Object, System.Object>(IronRuby.Builtins.KernelOps.PutString) + new Action(IronRuby.Builtins.KernelOps.PutsEmptyLine) ); DefineLibraryMethod(module, "raise", 0x61, @@ -5844,6 +5859,11 @@ new Func(IronRuby.Builtins.MutableStringOps.GetEncoding) ); + DefineLibraryMethod(module, "end_with?", 0xbb0051, + 0x00020000U, + new Func(IronRuby.Builtins.MutableStringOps.EndsWith) + ); + DefineLibraryMethod(module, "eql?", 0x51, 0x00000002U, 0x00000000U, new Func(IronRuby.Builtins.MutableStringOps.Eql), @@ -6036,6 +6056,11 @@ new Func(IronRuby.Builtins.MutableStringOps.SqueezeInPlace) ); + DefineLibraryMethod(module, "start_with?", 0xbb0051, + 0x00020000U, + new Func(IronRuby.Builtins.MutableStringOps.StartsWith) + ); + DefineLibraryMethod(module, "strip", 0x51, 0x00000000U, new Func(IronRuby.Builtins.MutableStringOps.Strip) @@ -10707,6 +10732,7 @@ #if !SILVERLIGHT DefineGlobalClass("Win32API", typeof(IronRuby.StandardLibrary.Win32API.Win32API), 0x00000008, classRef0, LoadWin32API_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray, new Func(IronRuby.StandardLibrary.Win32API.Win32API.Create), + new Func(IronRuby.StandardLibrary.Win32API.Win32API.Create), new Func, IronRuby.Builtins.RubyClass, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString, System.Collections.IList, IronRuby.Builtins.MutableString, IronRuby.StandardLibrary.Win32API.Win32API>(IronRuby.StandardLibrary.Win32API.Win32API.Create) ); #endif =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/BigNumOps.cs;C1162930 File: BigNumOps.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/BigNumOps.cs;C1162930 (server) 2/16/2010 9:42 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/BigNumOps.cs;r187 @@ -45,5 +45,10 @@ public static int Size(BigInteger/*!*/ self) { return self.GetWordCount() * 4; } + + [RubyMethod("fdiv", Compatibility = RubyCompatibility.Ruby19)] + public static double FDiv(BigInteger/*!*/ self, [NotNull]BigInteger/*!*/ other) { + return ((double)self) / ((double)other); + } } } =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FixnumOps.cs;C1496258 File: FixnumOps.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FixnumOps.cs;C1496258 (server) 2/16/2010 9:38 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FixnumOps.cs;r187 @@ -76,5 +76,10 @@ } throw RubyExceptions.CreateRangeError("Float {0} out of range of {1}", value, self.Name); } + + [RubyMethod("fdiv", Compatibility=RubyCompatibility.Ruby19)] + public static double FDiv(int self, [DefaultProtocol]int other) { + return self / (double)other; + } } } =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cs;C1589426 File: KernelOps.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cs;C1589426 (server) 2/17/2010 11:40 AM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cs;r187 @@ -894,6 +894,14 @@ // 1.9: public_send + [RubyMethod("tap", Compatibility=RubyCompatibility.Ruby187)] + public static object Tap(RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, object/*!*/ self) { + + object blockResult; + block.Yield(self, out blockResult); + return self; + } + #endregion #region clr_member, method, 1.9: public_method, define_singleton_method =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs;C1586787 File: MutableStringOps.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs;C1586787 (server) 2/16/2010 11:42 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs;r187 @@ -1717,6 +1717,26 @@ return true; } + [RubyMethod("start_with?", Compatibility = RubyCompatibility.Ruby187)] + public static bool StartsWith(RubyScope/*!*/ scope, MutableString/*!*/ self, + [DefaultProtocol, DefaultParameterValue(null)]MutableString subString) { + + if (subString == null || (self.Length > subString.Length)) { + return false; + } + return self.GetSlice(subString.Length).Equals(subString); + } + + [RubyMethod("end_with?", Compatibility = RubyCompatibility.Ruby187)] + public static bool EndsWith(RubyScope/*!*/ scope, MutableString/*!*/ self, + [DefaultProtocol, DefaultParameterValue(null)]MutableString subString) { + + if (subString == null) { + return false; + } + return self.EndsWith(subString.ConvertToString()); + } + #endregion =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Win32API/Win32API.cs;C1438355 File: Win32API.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Win32API/Win32API.cs;C1438355 (server) 2/16/2010 11:19 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Win32API/Win32API.cs;r187 @@ -189,6 +189,18 @@ return Reinitialize(new Win32API(self), libraryName, functionName, parameterTypes, returnType); } + [RubyConstructor(Compatibility=RubyCompatibility.Ruby19)] + public static Win32API/*!*/ Create(RubyClass/*!*/ self, + [DefaultProtocol, NotNull]MutableString/*!*/ libraryName, + [DefaultProtocol, NotNull]MutableString/*!*/ functionName, + [DefaultProtocol, NotNull]MutableString/*!*/ parameterTypes, + [DefaultProtocol, NotNull]MutableString/*!*/ returnType, + RubySymbol callingConvention) { + + Debug.Assert(callingConvention.ToString() == "stdcall"); + return Reinitialize(new Win32API(self), libraryName, functionName, parameterTypes, returnType); + } + [RubyConstructor] public static Win32API/*!*/ Create( ConversionStorage/*!*/ toStr, =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libs/rbconfig.rb;C1544319 File: rbconfig.rb =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libs/rbconfig.rb;C1544319 (server) 2/16/2010 11:22 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libs/rbconfig.rb;r187 @@ -15,9 +15,6 @@ module Config - RUBY_VERSION == "1.8.6" or - raise "ruby lib version (1.8.6) doesn't match executable version (#{RUBY_VERSION})" - CONFIG = {} CONFIG["MAJOR"] = "1" CONFIG["MINOR"] = "8" =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/RubyCompatibility.cs;C791094 File: RubyCompatibility.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/RubyCompatibility.cs;C791094 (server) 2/17/2010 3:22 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/RubyCompatibility.cs;r187 @@ -17,6 +17,7 @@ public enum RubyCompatibility { Default = Ruby18, Ruby18 = 0, + Ruby187 = 187, Ruby19 = 190, Ruby20 = 200, } =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyOptionsParser.cs;C1546541 File: RubyOptionsParser.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyOptionsParser.cs;C1546541 (server) 2/17/2010 3:22 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyOptionsParser.cs;r187 @@ -246,6 +246,10 @@ LanguageSetup.Options["Compatibility"] = RubyCompatibility.Ruby18; break; + case "-187": + LanguageSetup.Options["Compatibility"] = RubyCompatibility.Ruby187; + break; + case "-19": LanguageSetup.Options["Compatibility"] = RubyCompatibility.Ruby19; break; @@ -382,7 +386,8 @@ { "-trace", "enable support for set_trace_func" }, { "-profile", "enable support for 'pi = IronRuby::Clr.profile { block_to_profile }'" }, - { "-18", "Ruby 1.8 mode" }, + { "-18", "Ruby 1.8 mode (default)" }, + { "-187", "Ruby 1.8.7 mode" }, { "-19", "Ruby 1.9 mode" }, { "-20", "Ruby 2.0 mode" }, =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyContext.cs;C1589426 File: RubyContext.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyContext.cs;C1589426 (server) 2/16/2010 11:01 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyContext.cs;r187 @@ -51,7 +51,18 @@ private static int _RuntimeIdGenerator = 0; // MRI compliance: - public static readonly string/*!*/ MriVersion = "1.8.6"; + public string/*!*/ MriVersion { + get { + switch(RubyOptions.Compatibility) { + case RubyCompatibility.Ruby18: return "1.8.6"; + case RubyCompatibility.Ruby187: return "1.8.7"; + case RubyCompatibility.Ruby19: return "1.9.1"; + case RubyCompatibility.Ruby20: return "2.0.0"; + default: throw new InvalidOperationException(); + } + } + } + public static readonly string/*!*/ MriReleaseDate = "2009-03-31"; public static readonly int MriPatchLevel = 368; @@ -539,7 +550,7 @@ private void InitializeGlobalConstants() { Debug.Assert(_objectClass != null); - MutableString version = MutableString.CreateAscii(RubyContext.MriVersion); + MutableString version = MutableString.CreateAscii(MriVersion); MutableString platform = MakePlatformString(); MutableString releaseDate = MutableString.CreateAscii(RubyContext.MriReleaseDate); =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExceptionData.cs;C1589426 File: RubyExceptionData.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExceptionData.cs;C1589426 (server) 2/17/2010 11:00 AM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExceptionData.cs;r187 @@ -280,9 +280,15 @@ internal static string/*!*/ EncodeMethodName(string/*!*/ methodName, string sourcePath, SourceSpan location) { // encodes line number, file name into the method name - string fileName = sourcePath != null ? Path.GetFileName(sourcePath) : null; + string fileName; + try { + fileName = sourcePath != null ? Path.GetFileName(sourcePath) : null; + } catch (System.ArgumentException) { + // sourcePath can be specified by the user. We have to deal with the case of it not being well-formed + fileName = sourcePath; + } return String.Format(RubyMethodPrefix + "{0};{1};{2};{3}", methodName, fileName, location.IsValid ? location.Start.Line : 0, - Interlocked.Increment(ref _Id)); + Interlocked.Increment(ref _Id)); } // \u2111\u211c;{method-name};{file-name};{line-number};{dlr-suffix} =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Scripts/irtests.rb;C1570153 File: irtests.rb =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Scripts/irtests.rb;C1570153 (server) 2/17/2010 11:44 AM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Scripts/irtests.rb;r187 @@ -45,7 +45,9 @@ :ActionPack => "#{@root}\\Languages\\Ruby\\Tests\\Scripts\\utr.bat action_pack", :ActiveSupport => "#{@root}\\Languages\\Ruby\\Tests\\Scripts\\utr.bat active_support", :ActiveRecord => "#{@root}\\Languages\\Ruby\\Tests\\Scripts\\utr.bat active_record", - :ActiveResource => "#{@root}\\Languages\\Ruby\\Tests\\Scripts\\utr.bat active_resource" + :ActiveResource => "#{@root}\\Languages\\Ruby\\Tests\\Scripts\\utr.bat active_resource", + + :ActionPack3 => "#{ir} -187 #{@root}\\Languages\\Ruby\\Tests\\Scripts\\utr.rb action_pack_3", }) end @start = Time.now =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Tests/Scripts/generate_test-unit_tags.rb;C1570153 File: generate_test-unit_tags.rb =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Tests/Scripts/generate_test-unit_tags.rb;C1570153 (server) 2/17/2010 12:30 AM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Tests/Scripts/generate_test-unit_tags.rb;r187 @@ -11,11 +11,24 @@ match = / (test.*) # method name \( - (\w+) # testcase class name + (.+) # testcase class name (in parenthesis) \) /x.match(fault.test_name) + if match and match.size == 3 - [match[1], match[2]] + method_name, class_name = match[1], match[2] + if !(class_name =~ /^[\w:]+$/) and defined? ActiveSupport::Testing::Declarative + # class_name might be a descriptive string specified with ActiveSupport::Testing::Declarative.describe + ObjectSpace.each_object(Class) do |klass| + if klass.respond_to? :name + if klass.name == class_name + class_name = klass.to_s + break + end + end + end + end + [method_name, class_name] else warn "Could not parse test name : #{fault.test_name}" [fault.test_name, "Could not parse test name"] @@ -95,7 +108,11 @@ method_name = test_method_name(fault)[0] commented_message = fault.message[0..400] if fault.respond_to? :exception - commented_message += "\n" + fault.exception.backtrace[0..2].join("\n") + backtrace = fault.exception.backtrace[0..2].join("\n") + # Sometimes backtrace is an Array of size 1, where the first and only + # element is the string for the full backtrace + backtrace = backtrace[0..1000] + commented_message += "\n" + backtrace end commented_message = commented_message.gsub(/^(.*)$/, ' # \1') output.puts commented_message @@ -125,8 +142,20 @@ end if $0 == __FILE__ - # Dummy example for testing - require 'test/unit' + # Dummy examples for testing + + if RUBY_VERSION == "1.8.7" or RUBY_VERSION =~ /1.9/ + require 'rubygems' + gem 'test-unit', "= 2.0.5" + gem 'activesupport', "= 3.0.pre" + require 'active_support' + require 'active_support/test_case' + class TestCaseWithDescription < ActiveSupport::TestCase + describe "Hello there @%$" + def test_1() assert(false) end + end + end + class ExampleTest < Test::Unit::TestCase def teardown() if @teardown_error =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Tests/Scripts/utr.rb;C1590922 File: utr.rb =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Tests/Scripts/utr.rb;C1590922 (server) 2/16/2010 9:32 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Tests/Scripts/utr.rb;r187 @@ -1,3 +1,14 @@ +if RUBY_VERSION == '1.9.1' + # The 1.9 libraries are currently not included in ir.exe.config + $LOAD_PATH.unshift(File.expand_path('../External.LCA_RESTRICTED/Languages/Ruby/ruby-1.9.1p129/lib/ruby/1.9.1', ENV['MERLIN_ROOT'])) + # We want IronRuby's version of thread.rb to get precedence + $LOAD_PATH.unshift(File.expand_path('Languages/Ruby/Libs', ENV['MERLIN_ROOT'])) + # Rational is a core builtin type in 1.9 + require File.expand_path('../External.LCA_RESTRICTED/Languages/Ruby/ruby-1.8.6p368/lib/ruby/1.8/rational', ENV['MERLIN_ROOT']) + # 1.9 Gems are in a different format + ENV['GEM_PATH'] = ENV['GEM_HOME'] = File.expand_path('gems19', ENV['TMP']) +end + class UnitTestRunner def self.ironruby? defined?(RUBY_ENGINE) and RUBY_ENGINE == "ironruby" @@ -99,7 +110,8 @@ def run_test() @one_test =~/(.*)#(test_.*)/ class_name, test_name = $1, $2 - test_class = Object.const_get(class_name) + # Use class_eval instead of const_get in case of nested names like TestSuite::TestCase + test_class = Object.class_eval(class_name) test_class.new(test_name).run(TestResultLogger.new) {} =================================================================== add: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Tests/Scripts/utr/action_pack_3_tests.rb File: action_pack_3_tests.rb =================================================================== --- [no source file] +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Tests/Scripts/utr/action_pack_3_tests.rb;r187 @@ -1,0 +1,321 @@ +class Array + # RouteSet#deprecated_routes_for_controller_and_action_and_keys in actionpack\lib\action_controller\routing\route_set.rb in v3.0.pre + # assumes that sorting is stable (ie. if #<=> returns 0, then the relative order of the + # elements in the original array is maintained). However, Ruby does not guarantee a stable order + # according to ISO standard draft "15.3.2.1.19 Enumerable#sort" description and + # http://redmine.ruby-lang.org/issues/show/1089. + # + # Its unknown whether the failure in unit tests implies that Rails will misbehave (or if it just + # causes unoptimized routing for example). + # + def sort_by + elements_with_indices = [] + each_with_index {|elem, i| elements_with_indices << [elem, i] } + elements_with_indices.sort! do |a, b| + c = yield(a[0]) <=> yield(b[0]) + c == 0 ? a[1] <=> b[1] : c + end + elements_with_indices.map {|a| a[0]} + end +end + +# We need to ensure that ActiveRecordTestConnector.able_to_connect (actionpack/test/active_record_unit.rb) +# always returns false. Otherwise, an attempt will be made to open a database connection, +# and it pops up a dialog box. We add this logic here so that we do not have to modify +# the Rails tests which makes it easy to update them from version to version. +class ActiveRecordTestConnector + def self.singleton_method_added(name) + if name == :able_to_connect and not @unpatching + @unpatching = true + def self.able_to_connect() + false + end + end + end +end + +class UnitTestSetup + def initialize + @name = "ActionPack" + super + end + + def require_files + require 'rubygems' + gem 'test-unit', "= 2.0.5" + gem 'actionmailer', "= 3.0.pre" + gem 'activerecord', "= 3.0.pre" + gem 'activesupport', "= 3.0.pre" + gem 'actionpack', "= 3.0.pre" + require 'action_pack/version' + require 'active_record' + require 'active_record/fixtures' + end + + def gather_files + @root_dir = File.expand_path '..\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack', ENV['MERLIN_ROOT'] + $LOAD_PATH << @root_dir + @all_test_files = Dir.glob("#{@root_dir}/[cft]*/**/*_test.rb").sort + end + + def sanity + # Do some sanity checks + sanity_size(80) + abort("Did not find some expected files...") unless File.exist?(@root_dir + "/controller/action_pack_assertions_test.rb") + sanity_version('3.0.pre', ActionPack::VERSION::STRING) + end + + def disable_mri_failures + end + + def disable_tests + + disable ActionCacheTest, + # is not true. + :test_xml_version_of_resource_is_treated_as_different_cache + + disable AssertSelectTest, + # Exception raised: + # Class: + # Message: <"can't convert Symbol into Proc"> + # ---Backtrace--- + # selector.rb:286:in `assert_select' + # D:\vs_langs01_s\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Extensions\IListOps.cs:807:in `DeleteIf' + # D:\vs_langs01_s\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Extensions\IListOps.cs:758:in `delete_if' + # selector.rb:195:in `assert_select' + # d:/vs_langs01_s + :test_assert_select_text_match, + # Exception raised: + # Class: + # Message: <"can't convert Symbol into Proc"> + # ---Backtrace--- + # d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/controller/assert_select_test.rb:126:in `test_equality_of_html' + # selector.rb:286:in `assert_select' + # D:\vs_langs01_s\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Extensions\IListOps.cs:807:in `Dele + :test_equality_of_html + + disable AssetTagHelperTest, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\public\javascripts\all.js' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_caching_javascript_include_tag_when_caching_on, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\public\javascripts\cache\money.js' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_caching_javascript_include_tag_when_caching_on_and_using_subdirectory, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\public\javascripts\vanilla.js' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_caching_javascript_include_tag_when_caching_on_with_2_argument_object_asset_host, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\public\javascripts\vanilla.js' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_caching_javascript_include_tag_when_caching_on_with_2_argument_proc_asset_host, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\public\javascripts\scripts.js' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_caching_javascript_include_tag_when_caching_on_with_proc_asset_host, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\public\javascripts\combined.js' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_caching_javascript_include_tag_with_all_and_recursive_puts_defaults_at_the_start_of_the_file, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\public\javascripts\combined.js' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_caching_javascript_include_tag_with_all_puts_defaults_at_the_start_of_the_file, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\public\javascripts\all.js' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_caching_javascript_include_tag_with_relative_url_root, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\public\stylesheets\all.css' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_caching_stylesheet_link_tag_when_caching_on, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\public\stylesheets\styles.css' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_caching_stylesheet_link_tag_when_caching_on_with_proc_asset_host, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\public\stylesheets\all.css' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_caching_stylesheet_link_tag_with_relative_url_root, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\public\stylesheets\all.css' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_concat_stylesheet_link_tag_when_caching_off + + disable CachedViewRenderTest, + # ActionView::MissingTemplate: Missing template /d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/template/../fixtures/test/hello_world.erb - {:formats=>nil} - partial: false in view path d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/fixtures + # d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/Ruby/ruby-1.8.6p368/lib/ruby/gems/1.8/gems/actionpack-3.0.pre/lib/action_view/paths.rb:48:in `find' + # d:2:in `find' + # D:\vs_langs01_s\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtins\KernelOps.cs:835:in `send' + :test_render_file_with_full_path, + # <"undefined method `doesnt_exist' for #[d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/fixtures/test/_raise.html.erb], :partials=>{d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/fixtures/test/_raise.html.erb=>1}}, @formats=nil, @secret=\"in + :test_render_partial_with_errors, + # <"undefined method `doesnt_exist' for #[d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/fixtures/test/sub_template_raise.html.erb, d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/fixtures/test/_raise.html.erb], :partials=>{d:/vs_langs01_s/Mer + :test_render_sub_template_with_errors + + disable CompiledTemplatesTest, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\test\hello_world.erb' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_template_changes_are_not_reflected_with_cached_templates, + # Errno::EACCES: Access to the path 'd:\vs_langs01_s\Merlin\External.LCA_RESTRICTED\Languages\IronRuby\tests\RailsTests-3.0.pre\actionpack\fixtures\test\hello_world.erb' is denied. + # mscorlib:0:in `WinIOError' + # mscorlib:0:in `Init' + # mscorlib:0:in `.ctor' + :test_template_changes_are_reflected_with_uncached_templates + + disable FormTagHelperTest, + # <""> expected to be == to + # <"">. + :test_boolean_options + + disable FragmentCachingTest, + # TypeError: can't convert Symbol into Proc + # d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/Ruby/ruby-1.8.6p368/lib/ruby/gems/1.8/gems/activesupport-3.0.pre/lib/active_support/notifications/fanout.rb:27:in `wait' + # d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/Ruby/ruby-1.8.6p368/lib/ruby/gems/1.8/gems/activesupport-3.0.pre/lib/active_support/notifications.rb:68:in `wait' + # d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/controller/caching_test.rb:643:in `test_fragment_for_logging' + :test_fragment_for_logging + + disable HelperTest, + # TypeError: can't convert Symbol into Proc + # d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/controller/helper_test.rb:123:in `test_helper_proxy' + # d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/Ruby/ruby-1.8.6p368/lib/ruby/gems/1.8/gems/test-unit-2.0.5/lib/test/unit/testsuite.rb:37:in `run' + # D:\vs_langs01_s\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtins\KernelOps.cs:780:in `__send__' + :test_helper_proxy + + disable LayoutSetInResponseTest, + # ActionView::MissingTemplate: Missing layout /d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/fixtures/layout_tests/layouts/layout_test.rhtml - {} - partial: false in view path d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/fixtures/layout_tests + # paths.rb:39:in `find' + # d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/Ruby/ruby-1.8.6p368/lib/ruby/gems/1.8/gems/actionpack-3.0.pre/lib/abstract_controller/layouts.rb:217:in `_find_layout' + # rendering_controller.rb:136:in `find_template' + :test_absolute_pathed_layout + + disable LazyViewRenderTest, + # ActionView::MissingTemplate: Missing template /d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/template/../fixtures/test/hello_world.erb - {:formats=>nil} - partial: false in view path d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/fixtures + # paths.rb:39:in `find' + # D:\vs_langs01_s\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtins\KernelOps.cs:835:in `send' + # d:1:in `find' + :test_render_file_with_full_path, + # <"undefined method `doesnt_exist' for #[d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/fixtures/test/_raise.html.erb], :partials=>{d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/fixtures/test/_raise.html.erb=>1}}, @formats=nil, @secret=\"in + :test_render_partial_with_errors, + # <"undefined method `doesnt_exist' for #[d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/fixtures/test/sub_template_raise.html.erb, d:/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/tests/RailsTests-3.0.pre/actionpack/fixtures/test/_raise.html.erb], :partials=>{d:/vs_langs01_s/Mer + :test_render_sub_template_with_errors + + disable RenderFile::TestBasic, + # <"The secret is in the sauce\n"> expected but was + # <"\n\n Action Controller: Exception caught\n