[SCM] ci-tooling packaging branch, master, updated. 697d07461388f26c46fbbd30414ccbbe0a8eb794

Harald Sitter apachelogger-guest at moszumanska.debian.org
Thu Mar 5 13:16:29 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=778e458

The following commit has been merged in the master branch:
commit 778e45845a33055ce16fa664dadd40d0903394c6
Author: Harald Sitter <sitter at kde.org>
Date:   Thu Mar 5 14:13:43 2015 +0100

    add assertbacktick which presently is a big code copy of assertsystem
    
    can't think of a terribly obvious way to metaprogram them into one base,
    unless one adds a heap of supporting class methods to some module to
    enable getting the consts out of a static thingy.
    the problem in particular is that we would prepend a base to AssertSystem
    and AssertBacktick specifically and then prepend those to the actual tests
    which means we want instance methods which means self will be the test not
    the module. Bit of a headache material so if we move towards shared base
    it would pretty much have to be supported by some supporting code in the
    form of class methods....
    
    I am not sure I understand what I wrote either.
---
 test/lib/{assert_system.rb => assert_backtick.rb} | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/test/lib/assert_system.rb b/test/lib/assert_backtick.rb
similarity index 70%
copy from test/lib/assert_system.rb
copy to test/lib/assert_backtick.rb
index ccf3376..d77a5e5 100644
--- a/test/lib/assert_system.rb
+++ b/test/lib/assert_backtick.rb
@@ -1,33 +1,34 @@
-# Prependable module enabling assert_system use by overriding Kernel.system
-module AssertSystem
+# Prependable module enabling assert_system use by overriding Kernel.`
+module AssertBacktick
   module_function
 
-  SETUP_BACKUP = :setup_system
-  ASSERT_BACKUP = :__system_orig
-  METHOD = :system
+  SETUP_BACKUP = :setup_backtick
+  ASSERT_BACKUP = :__backtick_orig
+  METHOD = :`
 
-  # TestUnit prepend to force alias diversion making #{Kernel.system} noop
+  # TestUnit prepend to force alias diversion making #{Kernel.`} noop
   def setup
     Kernel.send(:alias_method, SETUP_BACKUP, METHOD)
     Kernel.send(:define_method, METHOD) { |*_a| }
   end
 
-  # TestUnit prepend to remove alias diversion making #{Kernel.system} noop
+  # TestUnit prepend to remove alias diversion making #{Kernel.`} noop
   def teardown
     Kernel.send(:alias_method, METHOD, SETUP_BACKUP)
     Kernel.send(:undef_method, SETUP_BACKUP)
   end
 
   # Assert that a specific system call is made. The call itself is not made.
-  # @param args [Object] any suitable input of #{Kernel.system} that is expected
+  # @param args [Object] any suitable input of #{Kernel.`} that is expected
   # @param block [Block] this function yields to block to actually run a
   #   piece of code that is expected to cause the system call
   # @return [Object] return value of block
-  def assert_system(args, &block)
+  def assert_backtick(args, &block)
     assertee = self
     Kernel.send(:alias_method, ASSERT_BACKUP, METHOD)
     Kernel.send(:define_method, METHOD) do |*a|
       assertee.assert_equal([*args], [*a])
+      ''
     end
     block.yield
   ensure

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list