Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
FourierTransformer committed Oct 31, 2024
0 parents commit 876a176
Show file tree
Hide file tree
Showing 6 changed files with 2,320 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/test-and-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Run Tests and Code Coverage

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
luaVersion: [lua=5.1, lua=5.2, lua=5.3, lua=5.4, luajit=2.0, [email protected]]
steps:
# Checks-out the repository under $GITHUB_WORKSPACE.
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '>=1.19'

- name: Install Lua (${{ matrix.lua }})
run: |
pip install hererocks
hererocks lua_install -r^ --${{ matrix.lua }}
- name: Install toml-test
run: go install github.com/toml-lang/toml-test/cmd/[email protected]

- name: install depedencies
run: |
luarocks install lua-cjson
luarocks install luacov
luarocks install luacov-coveralls
- name: run unit tests with coverage
run: toml-test lua -llcov spec/test-runner.lua

- name: Report test coverage
if: success()
continue-on-error: true
run: luacov-coveralls -e .luarocks
env:
COVERALLS_REPO_TOKEN: ${{ github.token }}

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# tinytoml
9 changes: 9 additions & 0 deletions spec/toml-test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
local cjson = require("cjson")
local tinytoml = require("tinytoml")


local assign_value_function = function(value, value_type)
return { ["value"] = tostring(value), ["type"] = value_type }
end

print(cjson.encode(tinytoml.parse(io.read("*a"), { load_from_string = true, assign_value_function = assign_value_function })))
10 changes: 10 additions & 0 deletions spec/toml-test.tl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
local cjson = require("cjson")
local tinytoml = require("tinytoml")

-- the format toml-test expects
local assign_value_function = function(value: any, value_type?: string): any
return {["value"]=tostring(value), ["type"]=value_type}
end

print(cjson.encode(tinytoml.parse(io.read("*a"), {load_from_string=true, assign_value_function=assign_value_function})))

Loading

0 comments on commit 876a176

Please sign in to comment.