mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
commit shparse test
This commit is contained in:
@@ -2570,7 +2570,7 @@ func ClientSetCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (ss
|
||||
return nil, fmt.Errorf("invalid termfontsize, must be a number between 8-15: %v", err)
|
||||
}
|
||||
if newFontSize < 8 || newFontSize > 15 {
|
||||
return nil, fmt.Errorf("invalid termfontsize, must be a number between 8-15", err)
|
||||
return nil, fmt.Errorf("invalid termfontsize, must be a number between 8-15")
|
||||
}
|
||||
feOpts := clientData.FeOpts
|
||||
feOpts.TermFontSize = newFontSize
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,57 @@
|
||||
package cmdrunner
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func xTestParseAliases(t *testing.T) {
|
||||
m, err := ParseAliases(`
|
||||
alias cdg='cd work/gopath/src/github.com/sawka'
|
||||
alias s='scripthaus'
|
||||
alias x='ls;ls"'
|
||||
alias foo="bar \"hello\""
|
||||
alias x=y
|
||||
`)
|
||||
if err != nil {
|
||||
fmt.Printf("err: %v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("m: %#v\n", m)
|
||||
}
|
||||
|
||||
func xTestParseFuncs(t *testing.T) {
|
||||
file, err := os.ReadFile("./linux-decls.txt")
|
||||
if err != nil {
|
||||
t.Fatalf("error reading linux-decls: %v", err)
|
||||
}
|
||||
m, err := ParseFuncs(string(file))
|
||||
if err != nil {
|
||||
t.Fatalf("error parsing funcs: %v", err)
|
||||
}
|
||||
for key, val := range m {
|
||||
fmt.Printf("func: %s %d\n", key, len(val))
|
||||
}
|
||||
}
|
||||
|
||||
func testRSC(t *testing.T, cmd string, expected bool) {
|
||||
rtn := IsReturnStateCommand(cmd)
|
||||
if rtn != expected {
|
||||
t.Errorf("cmd [%s], rtn=%v, expected=%v", cmd, rtn, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsReturnStateCommand(t *testing.T) {
|
||||
testRSC(t, "FOO=1", true)
|
||||
testRSC(t, "FOO=1 X=2", true)
|
||||
testRSC(t, "ls", false)
|
||||
testRSC(t, "export X", true)
|
||||
testRSC(t, "export X=1", true)
|
||||
testRSC(t, "declare -x FOO=1", true)
|
||||
testRSC(t, "source ./test", true)
|
||||
testRSC(t, "unset FOO BAR", true)
|
||||
testRSC(t, "FOO=1; ls", true)
|
||||
testRSC(t, ". ./test", true)
|
||||
testRSC(t, "{ FOO=6; }", false)
|
||||
}
|
||||
Reference in New Issue
Block a user