# -*- tcl -*-
# toc_import_doctoc.test:  tests for the doctools::toc::import::doctoc package/plugin.
#
# Copyright (c) 2009 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
# All rights reserved.
#
# RCS: @(#) $Id: import_doctoc.test,v 1.1 2009/04/18 21:14:18 andreas_kupries Exp $

# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

testsNeedTcl     8.5
testsNeedTcltest 2.0

support {
    useAccel [useTcllibC] struct/tree.tcl  struct::tree
    TestAccelInit                          struct::tree

    useAccel [useTcllibC] struct/stack.tcl struct::stack
    TestAccelInit                          struct::stack

    useAccel [useTcllibC] struct/sets.tcl  struct::set
    TestAccelInit                          struct::set

    use      struct/list.tcl        struct::list
    use      snit/snit.tcl          snit
    use      fileutil/fileutil.tcl  fileutil
    use      log/logger.tcl         logger
    use      treeql/treeql.tcl      treeql

    use doctools2base/tcl_parse.tcl          doctools::tcl::parse
    use doctools2base/msgcat.tcl             doctools::msgcat

    useLocal msgcat_c.tcl       doctools::msgcat::toc::c
    useLocal structure.tcl      doctools::toc::structure
    useLocal parse.tcl doctools::toc::parse

    msgcat::mclocale C
}
testing {
    package provide doctools::toc::import::plugin 1
    # The above fakes plugin environment. Well, not completely. By
    # leaving out a definition for the 'include' alias the plugin is
    # signaled that there is no need to overwrite the GetFile command
    # of doctools::toc::parse with a version calling out to the plugin
    # manager, i.e. that it can still use the regular file operations.

    useLocal import_doctoc.tcl doctools::toc::import::doctoc
}

# -------------------------------------------------------------------------

# General set of error cases regarding the number of arguments.

test doctools-toc-import-doctoc-1.0 {import, wrong#args} -body {
    import
} -returnCodes error -result {wrong # args: should be "import text configuration"}

test doctools-toc-import-doctoc-1.1 {import, wrong#args} -body {
    import T
} -returnCodes error -result {wrong # args: should be "import text configuration"}

test doctools-toc-import-doctoc-1.2 {import, wrong#args} -body {
    import T C XXX
} -returnCodes error -result {wrong # args: should be "import text configuration"}

# toc_import_doctoc tests, numbering starts at 2
# -------------------------------------------------------------------------

array_unset env LANG*
array_unset env LC_*
set env(LANG) C ; # Usually default if nothing is set, OS X requires this.

# -------------------------------------------------------------------------

TestAccelDo struct::stack stkimpl {
    TestAccelDo struct::set setimpl {
	TestAccelDo struct::tree impl {
	    source [localPath tests/import_doctoc]
	}
    }
}

#----------------------------------------------------------------------
TestAccelExit struct::tree
TestAccelExit struct::set
TestAccelExit struct::stack
testsuiteCleanup
return
