metadata: category: "POSIX Basic Sample" description: Sample of converted basic POSIX tests tests: - name: echo simple steps: - send_line: echo hello expect_output: hello match_type: contains - name: echo with args steps: - send_line: echo one two three expect_output: one two three match_type: contains - name: printf basic steps: - send_line: printf 'test\n' expect_output: test match_type: contains - name: variable in quotes steps: - send_line: VAR=test; echo "$VAR" expect_output: test match_type: contains - name: parameter expansion default steps: - send_line: echo "${UNSET:-default}" expect_output: default match_type: contains - name: string length steps: - send_line: VAR=hello; echo "${#VAR}" expect_output: '5' match_type: contains - name: remove shortest prefix steps: - send_line: VAR=foo.bar.baz; echo "${VAR#*.}" expect_output: bar.baz match_type: contains - name: expr addition steps: - send_line: expr 5 + 3 expect_output: '8' match_type: contains - name: if true steps: - send_line: if true; then echo yes; fi expect_output: 'yes' # Quote to prevent YAML boolean parsing match_type: contains - name: simple function steps: - send_line: func() { echo hello; }; func expect_output: hello match_type: contains - name: function with args steps: - send_line: func() { echo $1 $2; }; func foo bar expect_output: foo bar match_type: contains - name: special var $# count steps: - send_line: set -- a b c; echo $# expect_output: '3' match_type: contains - name: special var $@ all args steps: - send_line: set -- a b c; echo $@ expect_output: a b c match_type: contains - name: true && echo steps: - send_line: true && echo success expect_output: success match_type: contains - name: set positional steps: - send_line: set -- a b c; echo $1 $2 $3 expect_output: a b c match_type: contains