[r9576]: / test / trunk / ooRexx / base / rexxutil / platform / unix / SysFileTree.testGroup  Maximize  Restore  History

Download this file

113 lines (89 with data), 4.7 kB

#!/usr/bin/rexx
/*
  SVN Revision: $Rev: 5144 $
  Change Date:  $Date: 2009-09-03 22:30:46 -0700 (Thu, 03 Sep 2009) $
*/
/*----------------------------------------------------------------------------*/
/*                                                                            */
/* Copyright (c) 2013 - 2013 Rexx Language Association. All rights reserved.  */
/*                                                                            */
/* This program and the accompanying materials are made available under       */
/* the terms of the Common Public License v1.0 which accompanies this         */
/* distribution. A copy is also available at the following address:           */
/* http://www.oorexx.org/license.html                                         */
/*                                                                            */
/* Redistribution and use in source and binary forms, with or                 */
/* without modification, are permitted provided that the following            */
/* conditions are met:                                                        */
/*                                                                            */
/* Redistributions of source code must retain the above copyright             */
/* notice, this list of conditions and the following disclaimer.              */
/* Redistributions in binary form must reproduce the above copyright          */
/* notice, this list of conditions and the following disclaimer in            */
/* the documentation and/or other materials provided with the distribution.   */
/*                                                                            */
/* Neither the name of Rexx Language Association nor the names                */
/* of its contributors may be used to endorse or promote products             */
/* derived from this software without specific prior written permission.      */
/*                                                                            */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS        */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT          */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS          */
/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT   */
/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,      */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED   */
/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,        */
/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY     */
/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING    */
/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS         */
/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.               */
/*                                                                            */
/*----------------------------------------------------------------------------*/

    parse source . . fileSpec

    group = .TestGroup~new(fileSpec)
    group~addWithSuite(.SysFileTree.testGroup, .SysFileTreeSuite)

    -- knownOSes is a set.  We need a copy because we are going to remove
    -- Windows from the set.
    oses = group~knownOSes~copy
    w = oses~remove("WINDOWS")
    group~restrictOS(oses)

    if group~isAutomatedTest then return group

    testResult = group~suite~execute~~print

return testResult
-- End of entry point.

::requires 'ooTest.frm'

::class 'SysFileTreeSuite' public subclass ooTestSuite

::method setUp
    expose curdir

    -- We save the current directory and then change to the directory of the
    -- test group, so that we are in a known location for the tests.
    curDir = directory()

    parse source . . fileSpec
    newDir = FileSpec('L', fileSpec)
    j = directory(newDir)

::method tearDown
    expose curDir

    -- Change back to the current directory we were in before the tests
    -- were run.
    j = directory(curDir)



::class 'SysFileTree.testGroup' subclass ooTestCase public

::method 'testBasicSyntax1'
    self~expectSyntax(88.901)
    rv = SysFileTree()

::method 'testBasicSyntax2'
    self~expectSyntax(88.901)
    rv = SysFileTree(.true)

::method 'testBasicSyntax3'
    -- 1 is a valid fileSpec
    rv = SysFileTree(.true, files.)
    self~assertEquals(0, rv)

::method 'testBasicSyntax4'
    -- 1 is a valid fileSpec
    rv = SysFileTree(.true, 'cat')
    self~assertEquals(0, rv)

    -- No files named '1' should be found
    self~assertEquals(0, cat.0)

::method 'testBasicSyntax5'
    cat = .array~new(5)
    self~expectSyntax(40.919)
    rv = SysFileTree(.true, cat)