Skip to content

Commit

Permalink
lang: funcs: structs: Change names for tests
Browse files Browse the repository at this point in the history
Make the printable names look like the previous names.
  • Loading branch information
purpleidea committed Aug 28, 2023
1 parent ef77625 commit c62afe3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lang/funcs/structs/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ type ConstFunc struct {
// String returns a simple name for this function. This is needed so this struct
// can satisfy the pgraph.Vertex interface.
func (obj *ConstFunc) String() string {
return ConstFuncName
//return fmt.Sprintf("%s: %s(%s)", ConstFuncName, obj.Value.Type().String(), obj.Value.String())
return fmt.Sprintf("%s(%s)", obj.Value.Type().String(), obj.Value.String())
}

// Validate makes sure we've built our struct properly.
Expand Down
4 changes: 3 additions & 1 deletion lang/funcs/structs/var.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package structs
import (
"context"
"fmt"
"strings"

"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
Expand All @@ -46,7 +47,8 @@ type VarFunc struct {
// String returns a simple name for this function. This is needed so this struct
// can satisfy the pgraph.Vertex interface.
func (obj *VarFunc) String() string {
return VarFuncName
// XXX: This is a bit of a temporary hack to display it nicely.
return fmt.Sprintf("%s(%s)", VarFuncName, strings.TrimPrefix(obj.Edge, "var:"))
}

// Validate makes sure we've built our struct properly.
Expand Down

0 comments on commit c62afe3

Please sign in to comment.