tests: cram: Lua: add test case for uci_get_errorstr
[project/uci.git] / tests / cram / test_ucilua.t
1 set LUA_CPATH and ucilua for convenience:
2
3 $ export LC_ALL=C
4 $ [ -n "$UCI_LUA" ] && export LUA_CPATH="$(dirname "$UCI_LUA")/?.so"
5 $ alias ucilua="valgrind --quiet --leak-check=full lua -luci"
6
7 check available methods:
8
9 $ ucilua -e 'table.foreach(uci,function(m) print(m) end)'
10 add_history
11 add_delta
12 close
13 set_confdir
14 save
15 cursor
16 get_all
17 foreach
18 __gc
19 delete
20 set_savedir
21 set
22 revert
23 get_savedir
24 changes
25 reorder
26 get_confdir
27 list_configs
28 commit
29 unload
30 rename
31 add
32 load
33 get
34
35 run basic Lua tests:
36
37 $ cp -R "$TESTDIR/config" .
38 $ export CONFIG_DIR=$(pwd)/config
39 $ ucilua $TESTDIR/lua/basic.lua
40 ---------------
41 enabled: off
42 .anonymous: false
43 ipaddr: 2.3.4.5
44 .index: 2
45 .name: lan
46 test: 123
47 .type: interface
48 ifname: eth0
49 proto: static
50 ---------------
51 .name: wan
52 .type: interface
53 .index: 3
54 enabled: on
55 ifname: eth1
56 proto: dhcp
57 .anonymous: false
58 aliases: c d
59 nil\tuci: Parse error (EOF with unterminated ') at line 1, byte 18 (esc)