You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by kc...@apache.org on 2008/06/18 02:49:18 UTC

svn commit: r668890 - in /incubator/thrift/trunk/test/rb: ./ generation/ integration/

Author: kclark
Date: Tue Jun 17 17:49:17 2008
New Revision: 668890

URL: http://svn.apache.org/viewvc?rev=668890&view=rev
Log:
Reorganize tests

Added:
    incubator/thrift/trunk/test/rb/generation/
    incubator/thrift/trunk/test/rb/generation/test_struct.rb
      - copied, changed from r668889, incubator/thrift/trunk/test/rb/TestSmallService.rb
    incubator/thrift/trunk/test/rb/integration/
    incubator/thrift/trunk/test/rb/integration/test_simple_handler.rb
      - copied, changed from r668889, incubator/thrift/trunk/test/rb/TestThrift.rb
    incubator/thrift/trunk/test/rb/test_helper.rb
    incubator/thrift/trunk/test/rb/test_suite.rb
Removed:
    incubator/thrift/trunk/test/rb/TestClient-nb.rb
    incubator/thrift/trunk/test/rb/TestHandler.rb
    incubator/thrift/trunk/test/rb/TestSmallService.rb
    incubator/thrift/trunk/test/rb/TestSuite.rb
    incubator/thrift/trunk/test/rb/TestThrift.rb
Modified:
    incubator/thrift/trunk/test/rb/Makefile

Modified: incubator/thrift/trunk/test/rb/Makefile
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/rb/Makefile?rev=668890&r1=668889&r2=668890&view=diff
==============================================================================
--- incubator/thrift/trunk/test/rb/Makefile (original)
+++ incubator/thrift/trunk/test/rb/Makefile Tue Jun 17 17:49:17 2008
@@ -16,7 +16,7 @@
 	$(THRIFT) --gen rb ../SmallTest.thrift
 
 tests: stubs
-	ruby TestSuite.rb
+	ruby test_suite.rb
 
 clean:
 	$(RM) -r gen-rb

Copied: incubator/thrift/trunk/test/rb/generation/test_struct.rb (from r668889, incubator/thrift/trunk/test/rb/TestSmallService.rb)
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/rb/generation/test_struct.rb?p2=incubator/thrift/trunk/test/rb/generation/test_struct.rb&p1=incubator/thrift/trunk/test/rb/TestSmallService.rb&r1=668889&r2=668890&rev=668890&view=diff
==============================================================================
--- incubator/thrift/trunk/test/rb/TestSmallService.rb (original)
+++ incubator/thrift/trunk/test/rb/generation/test_struct.rb Tue Jun 17 17:49:17 2008
@@ -1,15 +1,9 @@
-#!/usr/bin/env ruby
-
-$:.push('gen-rb')
-$:.push('../../lib/rb/lib')
-
+require File.join(File.dirname(__FILE__), '../test_helper')
 require 'SmallService'
-require 'rubygems'
-require 'test/unit'
 
-class TestSmallService < Test::Unit::TestCase
+class TestStructGeneration < Test::Unit::TestCase
 
-  def test_default_value
+  def test_default_values
     hello = Hello.new
 
     assert_kind_of(Hello, hello)

Copied: incubator/thrift/trunk/test/rb/integration/test_simple_handler.rb (from r668889, incubator/thrift/trunk/test/rb/TestThrift.rb)
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/rb/integration/test_simple_handler.rb?p2=incubator/thrift/trunk/test/rb/integration/test_simple_handler.rb&p1=incubator/thrift/trunk/test/rb/TestThrift.rb&r1=668889&r2=668890&rev=668890&view=diff
==============================================================================
--- incubator/thrift/trunk/test/rb/TestThrift.rb (original)
+++ incubator/thrift/trunk/test/rb/integration/test_simple_handler.rb Tue Jun 17 17:49:17 2008
@@ -1,17 +1,43 @@
-#!/usr/bin/env ruby
-
-$:.push('gen-rb')
-$:.push('../../lib/rb/lib')
+require File.join(File.dirname(__FILE__), '../test_helper')
 
 require 'thrift/transport/tsocket'
 require 'thrift/protocol/tbinaryprotocol'
 require 'thrift/server/tserver'
 require 'ThriftTest'
-require 'TestHandler'
 
-require 'rubygems'
-require 'test/unit'
+class TestHandler
+  [:testString, :testByte, :testI32, :testI64, :testDouble,
+   :testStruct, :testMap, :testSet, :testList, :testNest,
+   :testEnum, :testTypedef].each do |meth|
+
+    define_method(meth) do |thing|
+      thing
+    end
+
+  end
+
+  def testInsanity(thing)
+    num, uid = thing.userMap.find { true }
+    return {uid => {num => thing}}
+  end
+
+  def testMapMap(thing)
+    return {thing => {thing => thing}}
+  end
+
+  def testEnum(thing)
+    return thing
+  end
+
+  def testTypedef(thing)
+    return thing
+  end
+
+  def testException(thing)
+    raise Thrift::Test::Xception, 'error'
+  end
 
+end
 class TestThrift < Test::Unit::TestCase
 
   @@INIT = nil

Added: incubator/thrift/trunk/test/rb/test_helper.rb
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/rb/test_helper.rb?rev=668890&view=auto
==============================================================================
--- incubator/thrift/trunk/test/rb/test_helper.rb (added)
+++ incubator/thrift/trunk/test/rb/test_helper.rb Tue Jun 17 17:49:17 2008
@@ -0,0 +1,4 @@
+$:.push File.dirname(__FILE__) + '/gen-rb'
+$:.push File.join(File.dirname(__FILE__), '../../lib/rb/lib')
+
+require 'test/unit'

Added: incubator/thrift/trunk/test/rb/test_suite.rb
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/rb/test_suite.rb?rev=668890&view=auto
==============================================================================
--- incubator/thrift/trunk/test/rb/test_suite.rb (added)
+++ incubator/thrift/trunk/test/rb/test_suite.rb Tue Jun 17 17:49:17 2008
@@ -0,0 +1 @@
+Dir["{core,generation,integration}/**/*"].each {|f| require f }
\ No newline at end of file