Install a moduli(5) manual page.
[dragonfly.git] / contrib / bsdinstaller-1.1.6 / src / backend / lua / scripts / test / apptest.lua
1 -- $Id: apptest.lua,v 1.7 2005/02/02 22:26:20 cpressey Exp $
2
3 require "app"
4 require "storage"
5
6 App.start({
7     name = "Test application",
8     logfile = "testapp.log",
9     ui = Dfui.new{
10         transport = "tcp",
11         rendezvous = "9999"
12     }
13 })
14
15 print("OS is: " .. App.os.name)
16
17 -- Create a storage-descriptor for the application.
18 App.state.storage = StorageDescriptor.new()
19 App.state.storage:survey()
20
21 print(App.expand("The root is ``${root}'' and the temp dir is ``${tmp}''."))
22 print(App.expand("And cpdup is ``${CPDUP}''."))
23 print(App.expand("And boo is ``${BOO}''."))
24
25 t1 = App.open_tmpfile("foo.txt", "w")
26 if t1 then
27         t1:write("This goes into foo.txt.")
28         t1:close()
29 else
30         App.log_warn("Can't open ${tmp}/foo.txt!")
31 end
32
33 t2, t2_name = App.open_tmpfile()
34 if t2 then
35         t2:write("This goes into some file called " .. t2_name .. ".")
36         t2:close()
37 else
38         App.log_warn("Can't open ${tmp}/" .. t2_name .. "!")
39 end
40
41 t1 = App.open_tmpfile("foo.txt", "r")
42 if t1 then
43         for line in t1:lines() do print("foo.txt:", line) end
44         t1:close()
45 end
46
47 t2 = App.open_tmpfile(t2_name, "r")
48 if t2 then
49         for line in t2:lines() do print(t2_name .. ":", line) end
50         t2:close()
51 end
52
53 App.view_log()
54
55 if App.ui:confirm("Confirm dialog test.  Show an inform dialog?") then
56         App.ui:inform("Inform dialog test.")
57 end
58
59 App.stop()