Skip to content

Commit

Permalink
feat: add cel functions
Browse files Browse the repository at this point in the history
  • Loading branch information
moshloop committed Jul 13, 2023
1 parent 9b9d527 commit c3f6d6c
Show file tree
Hide file tree
Showing 25 changed files with 547 additions and 2,583 deletions.
4 changes: 2 additions & 2 deletions cel/cel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/flanksource/gomplate/v3/funcs"
"github.com/google/cel-go/cel"
"gotest.tools/v3/assert"
"github.com/stretchr/testify/assert"
)

func panIf(err error) {
Expand All @@ -29,7 +29,7 @@ func executeTemplate(t *testing.T, i int, input string, output any) {
out, _, err := prg.Eval(map[string]any{})
panIf(err)

assert.DeepEqual(t, out.Value(), output)
assert.EqualValues(t, out.Value(), output)
}

func TestCelNamespace(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/gencel.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package main

import (
"flag"
"fmt"

"github.com/flanksource/commons/logger"
"github.com/flanksource/gomplate/v3/gencel"
)

Expand All @@ -13,7 +13,7 @@ func main() {
if len(args) == 0 {
args = []string{"."}
}
logger.Infof("Generating cel functions for %s\n", args)
fmt.Printf("Generating cel functions for %s\n", args)

g := gencel.Generator{}
g.ParsePkg(args...)
Expand Down
4 changes: 2 additions & 2 deletions cmd/gencel_test.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package main

import (
"fmt"
"os"
"testing"

"github.com/flanksource/commons/logger"
"github.com/flanksource/gomplate/v3/gencel"
)

// Not really a test but just a runner so it's easier to attach a debugger.
func TestGencel(t *testing.T) {
wd, _ := os.Getwd()
logger.Infof("WD: %s", wd)
fmt.Printf("WD: %s", wd)

args := []string{"../funcs"}
g := gencel.Generator{}
Expand Down
25 changes: 0 additions & 25 deletions data/mimetypes.go

This file was deleted.

22 changes: 0 additions & 22 deletions data/mimetypes_test.go

This file was deleted.

13 changes: 0 additions & 13 deletions func_test.go

This file was deleted.

67 changes: 67 additions & 0 deletions funcs/base64_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 10 additions & 39 deletions funcs/cel_gen_exports.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c3f6d6c

Please sign in to comment.