# -*- tcl -*-
# Commands covered:  none, common behaviour of all commands as implemented in 'registry.c'
#
# This file contains a collection of tests for one or more of the trf
# commands of the TRF extension. Sourcing this file into Tcl runs the
# tests and generates output for errors.  No output means no errors were
# found.
#
# Copyright (c) 1995 Andreas Kupries (a.kupries@westend.com)
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# $Id: common_all.test,v 1.3 2000/11/18 22:42:32 aku Exp $


test common-1.0 {common behaviour, error checking} {
    catch {bin} msg; set msg
} {bin: wrong # args}

test common-1.1 {common behaviour, error checking} {
    catch {bin -in} msg; set msg
} {bin: wrong # args, option "-in" requires an argument}

test common-1.2 {common behaviour, error checking} {
    catch {bin -in stdout} msg; set msg
} {bin: source-channel not readable}

test common-1.3 {common behaviour, error checking} {
    catch {bin -out stdin} msg; set msg
} {bin: destination-channel not writable}

test common-1.4 {common behaviour, error checking} {
    catch {bin -in stdin -attach stdout} msg; set msg
} {bin: inconsistent options, -in/-out not allowed with -attach}

test common-1.5 {common behaviour, error checking} {
    catch {bin -out stdout -attach stdout} msg; set msg
} {bin: inconsistent options, -in/-out not allowed with -attach}

test common-1.6 {common behaviour, error checking} {
    catch {bin -out stdout} msg; set msg
} {bin: wrong # args}

test common-1.7 {common behaviour, error checking} {
    catch {bin -in stdin XXX} msg; set msg
} {bin: wrong # args}


test common-2.0 {common behaviour: -in, -out} {
    set m [memchan]
    bin -out $m -mode encode A
    seek $m 0 start
    set res [bin -in $m -mode decode]
    close $m
    set res
} {A}




::tcltest::cleanupTests
