Skip to content

Commit

Permalink
retract old versions, fix missing symbolic padding
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseCoretta committed Aug 27, 2023
1 parent fdb3fe1 commit d615bed
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ module github.com/JesseCoretta/go-stackage

go 1.20

retract [v0.0.1-alpha.0, v0.0.2-alpha.2]
retract [v0.0.1-alpha.0, v0.0.2-alpha.4]

8 changes: 7 additions & 1 deletion stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,13 @@ func (r stack) assembleStringStack(str []string, ot string, oc stackType) string
// et al).
var tjn string
if len(r.getSymbol()) > 0 {
tjn = padValue(!r.positive(nspad), join(str, ot))
char := string(rune(32)) // by default, use WHSP padding for symbol ops
if r.positive(nspad) {
char = `` // ... unless user turns it off
}

sympad := padValue(!r.positive(nspad), char)
tjn = join(str, sprintf("%s%s%s", sympad, ot, sympad))
} else {
tjn = join(str, ot)
}
Expand Down
15 changes: 14 additions & 1 deletion stack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func TestAnd_004(t *testing.T) {
This example demonstrates ORed stack values using the double pipe (||) symbol
and custom value encapsulation.
*/
func ExampleOr_pipes() {
func ExampleOr_symbolicOr() {
or := Or().
Paren(). // Add parenthesis
Symbol(`||`). // Use double pipes for OR
Expand All @@ -251,6 +251,19 @@ func ExampleOr_pipes() {
// Output: ( "cn" || "sn" || "givenName" || "objectClass" || "uid" )
}

/*
This example demonstrates ANDed stack values using the double ampersand (&&) symbol.
*/
func ExampleAnd_symbolicAnd() {
and := And().
Paren(). // Add parenthesis
Symbol(`&&`). // Use double pipes for OR
Push(`condition1`, `condition2`, `condition3`) // Push these values now

fmt.Printf("%s\n", and)
// Output: ( condition1 && condition2 && condition3 )
}

func TestAnd_005_nestedWithTraversal(t *testing.T) {

A := And().NoPadding().Push(
Expand Down

0 comments on commit d615bed

Please sign in to comment.