Skip to content

Commit

Permalink
fmt rego
Browse files Browse the repository at this point in the history
  • Loading branch information
nikpivkin authored and simar7 committed May 14, 2024
1 parent ce55c4f commit 60ba9ba
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rego: fmt-rego test-rego

.PHONY: fmt-rego
fmt-rego:
opa fmt -w checks/
opa fmt -w lib/ checks/

.PHONY: test-rego
test-rego:
Expand Down
32 changes: 16 additions & 16 deletions lib/sh/sh_test.rego
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
package lib.sh

test_parse_commands_with_ampersands {
cmds := sh.parse_commands("apt update && apt install curl")
count(cmds) == 2
cmds[0] == ["apt", "update"]
cmds[1] == ["apt", "install", "curl"]
cmds := sh.parse_commands("apt update && apt install curl")
count(cmds) == 2
cmds[0] == ["apt", "update"]
cmds[1] == ["apt", "install", "curl"]
}

test_parse_commands_empty_input {
cmds := sh.parse_commands("")
count(cmds) == 0
cmds := sh.parse_commands("")
count(cmds) == 0
}

test_parse_commands_with_semicolon {
cmds := sh.parse_commands("apt update;apt install curl")
count(cmds) == 2
cmds[0] == ["apt", "update"]
cmds[1] == ["apt", "install", "curl"]
cmds := sh.parse_commands("apt update;apt install curl")
count(cmds) == 2
cmds[0] == ["apt", "update"]
cmds[1] == ["apt", "install", "curl"]
}

test_parse_commands_mixed {
cmds := sh.parse_commands("apt update; apt install curl && apt install git")
count(cmds) == 3
cmds[0] == ["apt", "update"]
cmds[1] == ["apt", "install", "curl"]
cmds[2] == ["apt", "install", "git"]
}
cmds := sh.parse_commands("apt update; apt install curl && apt install git")
count(cmds) == 3
cmds[0] == ["apt", "update"]
cmds[1] == ["apt", "install", "curl"]
cmds[2] == ["apt", "install", "git"]
}

0 comments on commit 60ba9ba

Please sign in to comment.