tyler-sommer/stick

OR operator evaluation bug

mingwho opened this issue · 2 comments

Hi Tyler it's me again :) It seems like if {% if true or false %} returns false
For example:

package main

import (
	"os"
	"github.com/tyler-sommer/stick"
)

func main() {
	env := stick.New(nil);    // A nil loader means stick will simply execute
                          // the string passed into env.Execute.

// Templates receive a map of string to any value.
p := map[string]stick.Value{"name": "World"}

// Substitute os.Stdout with any io.Writer.
env.Execute(`{% set item1 = "orange" %} {% set item2 = "apple" %} {% if item1 == "banana" or item2 == "apple" %} At least one item is correct {% else %} neither item is correct {% endif %}`, os.Stdout, p)
}

It will print neither item is correct.
I will have a look into this as well :)

Thanks for pointing this out, @mingwho ! It turned out to be a silly mistake on my part, and easily fixed in #31. Cheers!