aboutsummaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-10-06 01:33:12 +0700
committerShulhan <ms@kilabit.info>2023-10-06 01:33:12 +0700
commitb22f2104dd822a890b8f8b8de5489215493c0812 (patch)
tree08b4c281c95ff7f8693cddc3dce2ce25c46c57cf /testdata
parent006fe79d7523c47102462595d8e8664fc1910c6a (diff)
downloadawwan-b22f2104dd822a890b8f8b8de5489215493c0812.tar.xz
all: simplify parsing statement for magic command get
This changes minimize code duplication when parsing magic command between "#get:" and "#get!" using single function parseStatementGetPut. In the returned Statement, we changes where to store the source argument into args[0] instead of in cmd for better readability and minimize confusion in Copy/SudoCopy. While at it, we add unit test for "#get:". Unit test for "#get!" is not possible right now, because it will prompt for password.
Diffstat (limited to 'testdata')
-rw-r--r--testdata/local/get.aww1
-rw-r--r--testdata/local/get.data5
2 files changed, 6 insertions, 0 deletions
diff --git a/testdata/local/get.aww b/testdata/local/get.aww
new file mode 100644
index 0000000..15878c6
--- /dev/null
+++ b/testdata/local/get.aww
@@ -0,0 +1 @@
+#get: {{.ScriptDir}}/plain.txt {{.ScriptDir}}/tmp/get_plain.txt
diff --git a/testdata/local/get.data b/testdata/local/get.data
new file mode 100644
index 0000000..0e7ee57
--- /dev/null
+++ b/testdata/local/get.data
@@ -0,0 +1,5 @@
+Test on magic command "#get:".
+
+<<< tmp/get_plain.txt
+The host name is {{.Val "host::name"}}.
+