Skip to content

Commit 77b9821

Browse files
committed
Add minimal CI
1 parent ca5f5c0 commit 77b9821

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Minimal CI to see the output
2+
name: CI
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags-ignore:
8+
- "v*"
9+
10+
pull_request:
11+
12+
jobs:
13+
test:
14+
strategy:
15+
matrix:
16+
lua-version: ["5.3", "5.4"]
17+
runs-on: ubuntu-20.04
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: leafo/gh-actions-lua@v10
21+
with:
22+
luaVersion: ${{ matrix.lua-version }}
23+
- uses: leafo/gh-actions-luarocks@v4
24+
25+
- name: build
26+
run: |
27+
luarocks install busted
28+
luarocks make
29+
30+
- name: test
31+
run: |
32+
busted -o codewars || true

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
11
# busted-codewars
22

33
Codewars output handler for [Busted](https://github.com/lunarmodules/busted).
4+
5+
## Install
6+
7+
```bash
8+
luarocks install busted-codewars
9+
```
10+
11+
## Usage
12+
13+
```bash
14+
busted -o codewars
15+
```
16+
17+
## Develop
18+
19+
Add example tests in `spec/` with a file name matching `*_spec.lua`.
20+
Then run the tests with Codewars output:
21+
22+
```bash
23+
luarocks test -- -o codewars
24+
```

spec/example_spec.lua

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-- Example from https://lunarmodules.github.io/busted/
2+
describe("Busted unit testing framework", function()
3+
describe("should be awesome", function()
4+
it("should be easy to use", function()
5+
assert.truthy("Yup.")
6+
end)
7+
8+
it("should have lots of features", function()
9+
-- deep check comparisons!
10+
assert.are.same({ table = "great"}, { table = "great" })
11+
12+
-- or check by reference!
13+
assert.are_not.equal({ table = "great"}, { table = "great"})
14+
15+
assert.truthy("this is a string") -- truthy: not false or nil
16+
17+
assert.True(1 == 1)
18+
assert.is_true(1 == 1)
19+
20+
assert.falsy(nil)
21+
assert.has_error(function() error("Wat") end, "Wat")
22+
end)
23+
24+
it("should provide some shortcuts to common functions", function()
25+
assert.are.unique({{ thing = 1 }, { thing = 2 }, { thing = 3 }})
26+
end)
27+
end)
28+
end)

0 commit comments

Comments
 (0)