Skip to content

Commit

Permalink
.github, parser: test, fuzz & lint all branches. fix fuzz seed typo.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmccarthy committed Mar 4, 2024
1 parent 0eba8cf commit aba44bf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ name: Go

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build:
Expand All @@ -25,3 +23,6 @@ jobs:

- name: Test
run: go test -v ./...

- name: Fuzz
run: mkdir -p testdata && go test -fuzz=FuzzParse -fuzztime 60s && go test -fuzz=FuzzTokenize -fuzztime 60s
2 changes: 0 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: golangci-lint
on:
push:
branches:
- main
pull_request:

permissions:
Expand Down
14 changes: 7 additions & 7 deletions x/exp/parser/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@ func FuzzParse(f *testing.F) {
`permit(principal,action,resource) when { resource in "foo" };`,
`permit(principal,action,resource) when { context.x == 42 };`,
`permit(principal,action,resource) when { context.x == 42 };`,
`mit(principal,action,resource) when { principal.x == 42 };`,
`mit(principal,action,resource) when { principal.x == 42 };`,
`mit(principal,action,resource) when { principal in parent::"bob" };`,
`permit(principal,action,resource) when { principal.x == 42 };`,
`permit(principal,action,resource) when { principal.x == 42 };`,
`permit(principal,action,resource) when { principal in parent::"bob" };`,
`permit(principal == coder::"cuzco",action,resource);`,
`mit(principal in team::"osiris",action,resource);`,
`permit(principal in team::"osiris",action,resource);`,
`permit(principal,action == table::"drop",resource);`,
`mit(principal,action in scary::"stuff",resource);`,
`mit(principal,action in [scary::"stuff"],resource);`,
`permit(principal,action in scary::"stuff",resource);`,
`permit(principal,action in [scary::"stuff"],resource);`,
`permit(principal,action,resource == table::"whatever");`,
`permit(principal,action,resource) unless { false };`,
`permit(principal,action,resource) when { (if true then true else true) };`,
`permit(principal,action,resource) when { (true || false) };`,
`permit(principal,action,resource) when { (true && true) };`,
`permit(principal,action,resource) when { (1<2) && (1<=1) && (2>1) && (1>=1) && (1!=2) && (1==1)};`,
`permit(principal,action,resource) when { principal in principal };`,
`mit(principal,action,resource) when { principal has name };`,
`permit(principal,action,resource) when { principal has name };`,
`permit(principal,action,resource) when { 40+3-1==42 };`,
`permit(principal,action,resource) when { 6*7==42 };`,
`permit(principal,action,resource) when { -42==-42 };`,
Expand Down

0 comments on commit aba44bf

Please sign in to comment.