Rev 30 | Blame | Compare with Previous | Last modification | View Log | RSS feed
## Licensed to the Apache Software Foundation (ASF) under one# or more contributor license agreements. See the NOTICE file# distributed with this work for additional information# regarding copyright ownership. The ASF licenses this file# to you under the Apache License, Version 2.0 (the# "License"); you may not use this file except in compliance# with the License. You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing,# software distributed under the License is distributed on an# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY# KIND, either express or implied. See the License for the# specific language governing permissions and limitations# under the License.#require File.join(File.dirname(__FILE__), '../../test_helper')require 'thrift'class DummyTransport < Thrift::BaseTransportdef initialize(data)@data = dataenddef read(size)@data.slice!(0, size)endend# TTransport is basically an abstract class, but isn't raising NotImplementedErrorclass TestThriftTransport < Test::Unit::TestCasedef setup@trans = Thrift::BaseTransport.newenddef test_open?assert_nil @trans.open?enddef test_openassert_nil @trans.openenddef test_closeassert_nil @trans.closeend# TODO:# This doesn't necessarily test he right thing.# It _looks_ like read isn't guarenteed to return the length# you ask for and read_all is. This means our test needs to check# for blocking. -- Kevin Clark 3/27/08def test_read_all# Implements readt = DummyTransport.new("hello")assert_equal "hello", t.read_all(5)enddef test_writeassert_nil @trans.write(5) # arbitrary valueenddef test_flushassert_nil @trans.flushendend