aboutsummaryrefslogtreecommitdiff
path: root/tests/package.test
blob: 1484bd6319ccb7add922bb199650f4f12041626a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
source [file dirname [info script]]/testing.tcl

needs constraint jim
needs cmd package

if {[exists -proc package]} {
	skiptest " (bootstrap jimsh)"
}

test package-1.1 {provide} -body {
	package provide new-package-name
	expr {"new-package-name" in [package names]}
} -result 1

test package-1.2 {provide, duplicate} -body {
	package provide new-package-name
} -returnCodes error -result {package "new-package-name" was already provided}

test package-1.3 {package names} -body {
	expr {"stdlib" in [package names]}
} -result 1

test package-2.1 {package forget} -body {
	# First pretend the package was loaded
	package provide forget-test
	# Now it won't load anything
	package require forget-test
	# Now forget it and another unloaded test
	package forget forget-test missing
	# And load the local package
	package require forget-test
	info exists forgotten
} -result 1

testreport