1# -*- tcl -*-
2# Commands covered:  pkgconfig
3#
4# This file contains a collection of tests for one or more of the Tcl
5# built-in commands.  Sourcing this file into Tcl runs the tests and
6# generates output for errors.  No output means no errors were found.
7#
8# Copyright © 1991-1993 The Regents of the University of California.
9# Copyright © 1994-1996 Sun Microsystems, Inc.
10# Copyright © 1998-1999 Scriptics Corporation.
11#
12# See the file "license.terms" for information on usage and redistribution
13# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14
15if {"::tcltest" ni [namespace children]} {
16    package require tcltest 2.5
17    namespace import -force ::tcltest::*
18}
19
20test pkgconfig-1.1 {query keys} -body {
21    lsort [::tcl::pkgconfig list]
22} -match glob -result {64bit bindir,install bindir,runtime compile_debug compile_stats debug*docdir,install docdir,runtime includedir,install includedir,runtime libdir,install libdir,runtime mem_debug optimized profiled scriptdir,install scriptdir,runtime threaded}
23test pkgconfig-1.2 {query keys multiple times} {
24    string compare [::tcl::pkgconfig list] [::tcl::pkgconfig list]
25} 0
26test pkgconfig-1.3 {query value multiple times} {
27    string compare \
28	    [::tcl::pkgconfig get bindir,install] \
29	    [::tcl::pkgconfig get bindir,install]
30} 0
31
32
33test pkgconfig-2.0 {error: missing subcommand} {
34    catch {::tcl::pkgconfig} msg
35    set msg
36} {wrong # args: should be "::tcl::pkgconfig subcommand ?arg?"}
37test pkgconfig-2.1 {error: illegal subcommand} {
38    catch {::tcl::pkgconfig foo} msg
39    set msg
40} {bad subcommand "foo": must be get or list}
41test pkgconfig-2.2 {error: list with arguments} {
42    catch {::tcl::pkgconfig list foo} msg
43    set msg
44} {wrong # args: should be "::tcl::pkgconfig list"}
45test pkgconfig-2.3 {error: get without arguments} {
46    catch {::tcl::pkgconfig get} msg
47    set msg
48} {wrong # args: should be "::tcl::pkgconfig get key"}
49test pkgconfig-2.4 {error: query unknown key} {
50    catch {::tcl::pkgconfig get foo} msg
51    set msg
52} {key not known}
53test pkgconfig-2.5 {error: query with to many arguments} {
54    catch {::tcl::pkgconfig get foo bar} msg
55    set msg
56} {wrong # args: should be "::tcl::pkgconfig subcommand ?arg?"}
57
58# cleanup
59::tcltest::cleanupTests
60return
61