Skip to content

Commit

Permalink
Add support to functional tests #92 (#108)
Browse files Browse the repository at this point in the history
Include a low number of tests.
  • Loading branch information
filhodanuvem authored Oct 13, 2020
1 parent 7962afd commit 3642565
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ jobs:
with:
go-version: 1.12
id: go

- name: Setup BATS
uses: mig4/[email protected]
with:
bats-version: 1.1.0

- name: Check out code into the Go module directory
uses: actions/checkout@v1
Expand All @@ -30,6 +35,10 @@ jobs:
run: |
go build .
./gitql -v
- name: Run function tests
run: bats --tap ./tests

- uses: actions/upload-artifact@master
name: Generating artifact
with:
Expand All @@ -45,6 +54,11 @@ jobs:
with:
go-version: 1.12
id: go

- name: Setup BATS
uses: mig4/[email protected]
with:
bats-version: 1.1.0

- name: Check out code into the Go module directory
uses: actions/checkout@v1
Expand All @@ -59,6 +73,10 @@ jobs:
run: |
go build .
./gitql -v
- name: Run function tests
run: bats --tap ./tests

- uses: actions/upload-artifact@master
name: Generating artifact
with:
Expand All @@ -75,6 +93,11 @@ jobs:
go-version: 1.12
id: go

- name: Setup BATS
uses: mig4/[email protected]
with:
bats-version: 1.1.0

- name: Check out code into the Go module directory
uses: actions/checkout@v1

Expand All @@ -87,6 +110,9 @@ jobs:
go build .
.\gitql.exe -v
- name: Run function tests
run: bats --tap ./tests

- uses: actions/upload-artifact@master
name: Generating artifact
with:
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func main() {
},
&cli.BoolFlag{
Name: "show-tables",
Aliases: []string{"s"},
Hidden: true,
},
},
Expand Down
26 changes: 26 additions & 0 deletions tests/options.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bats

@test "Check version" {
result="$(./gitql -v)"
[ "$result" == "Gitql 2.1.0" ]
}

@test "Check table commits on -s" {
result="$(./gitql -s | grep commits)"
[ "$result" == "commits" ]
}

@test "Check table refs on -s" {
result="$(./gitql -s | grep refs)"
[ "$result" == "refs" ]
}

@test "Check table tags on -s" {
result="$(./gitql -s | grep tags)"
[ "$result" == "tags" ]
}

@test "Check table branches on -s" {
result="$(./gitql -s | grep branches)"
[ "$result" == "branches" ]
}

0 comments on commit 3642565

Please sign in to comment.