Skip to content

Commit ca21f76

Browse files
authored
0.2.0 (#7)
* Updated to toml++ v3.3.0 * Added `terseKeyValuePairs` to the list of formatting options for `toml.encode` * Tables can be made inline. * `toml.decode` can decode date, time and date-time into userdata or plain tables. * Use luaunit instead of busted for testing * Boolean values are decoded as booleans instead of integers. (#6) * Run tests on Windows * Start preparing for TOMLInt (userdata type for formatted integers) * If `lua` is not available, use `luajit` (Linux CI) * Update TOC * Date, time and date-time should not be quoted by default. * Update Changelog
1 parent e20c084 commit ca21f76

32 files changed

Lines changed: 882 additions & 330 deletions

.github/workflows/buildAndTest-Linux.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
sudo apt update
2525
sudo apt install -yq ${{ matrix.lua }} "$C_COMPILER_PACKAGE" "$CXX_COMPILER_PACKAGE"
2626
./scripts/buildLuaRocks.sh
27-
sudo luarocks install busted
27+
sudo luarocks install luaunit
2828
- name: "Build Project"
2929
run: |
3030
export COMPILER=${{ matrix.compiler }}
@@ -33,4 +33,11 @@ jobs:
3333
luarocks config "variables.CMAKE_CXX_COMPILER" "$CXX_COMPILER"
3434
sudo CXX="$CXX_COMPILER" CC="$C_COMPILER" luarocks make
3535
- name: "Test Project"
36-
run: "busted"
36+
run: |
37+
if ! command -v lua &> /dev/null
38+
then
39+
luajit tests/tests.lua
40+
exit
41+
else
42+
lua tests/tests.lua
43+
fi

.github/workflows/buildAndTest-MacOS.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
- name: "Install Dependencies"
1414
run: |
1515
brew install ${{ matrix.lua }} luarocks
16-
luarocks install busted
16+
luarocks install luaunit
1717
- name: "Build Project"
1818
run: "luarocks make"
1919
- name: "Test Project"
20-
run: "busted"
20+
run: "lua tests/tests.lua"

.github/workflows/buildAndTest-Windows.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,14 @@ jobs:
4343
4444
LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" config cmake_generator "Ninja Multi-Config"
4545
LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" make
46-
- name: "Run Example"
46+
- name: "Run Tests"
4747
run: |
4848
mkdir LuaRocks\tree\share\lua\5.1\
4949
$env:LUAROCKS_TREE=$(Resolve-Path LuaRocks\tree)
5050
$env:LUAROCKS_LUADIR=$(Resolve-Path LuaJIT\)
5151
$env:LUAROCKS_CONFIG="$(Resolve-Path LuaRocks\tree\luaRocksConfig.lua)"
5252
$env:LUA_CPATH="$(Resolve-Path LuaRocks\tree\lib\lua\5.1\)?.dll"
53-
$env:LUA_PATH="$(Resolve-Path LuaRocks\tree\share\lua\5.1\)?.lua"
54-
LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" install inspect
53+
$env:LUA_PATH="$(Resolve-Path LuaRocks\tree\share\lua\5.1\)?.lua;$($pwd.Path)\?.lua"
54+
LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" install luaunit
5555
56-
LuaJIT\bin\luajit.exe examples\example.lua
57-
# - name: "Set up MinGW"
58-
# uses: "egor-tensin/setup-mingw@v2"
59-
# with:
60-
# platform: "x64"
61-
# - name: "Install busted"
62-
# run: |
63-
# $env:LUAROCKS_TREE=$(Resolve-Path LuaRocks\tree)
64-
# $env:LUAROCKS_LUADIR=$(Resolve-Path LuaJIT\)
65-
# $env:LUAROCKS_CONFIG="$(Resolve-Path LuaRocks\tree\luaRocksConfig.lua)"
66-
67-
# LuaRocks/luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" install busted
56+
LuaJIT\bin\luajit.exe tests\tests.lua

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ compile_commands.json
66
*.rock
77
*.so
88
*.dll
9-
9+
.DS_Store
1010
Brewfile.lock.json
11-
.vscode
11+
.vscode/
12+
.nova/
13+
.vim/

CHANGELOG.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,77 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.0](https://github.com/LebJe/toml.lua/releases/tag/0.2.0) - 2023-02-12
9+
10+
### Added
11+
12+
- Updated to toml++ v3.3.0
13+
- Added `terseKeyValuePairs` to the list of formatting options for `toml.encode`
14+
- Tables can be made inline.
15+
- `toml.decode` can decode date, time and date-time into userdata (as before) or plain tables:
16+
17+
```lua
18+
local tomlStr = [[
19+
date = 1979-05-27
20+
time = 07:32:00
21+
datetime = 1979-05-27T07:32:00-07:00
22+
]]
23+
24+
local table1 = toml.decode(tomlStr, { temporalTypesAsUserData = true })
25+
local table2 = toml.decode(tomlStr, { temporalTypesAsUserData = false })
26+
27+
print(inspect(table1))
28+
--[[
29+
{
30+
date = <userdata 1> -- 1979-05-27,
31+
time = <userdata 2> -- 07:32:00,
32+
datetime = <userdata 3> -- 1979-05-27T07:32:00-07:00
33+
}
34+
--]]
35+
36+
print(inspect(table2))
37+
--[[
38+
{
39+
date = {
40+
day = 27,
41+
month = 5,
42+
year = 1979
43+
},
44+
datetime = {
45+
date = {
46+
day = 27,
47+
month = 5,
48+
year = 1979
49+
},
50+
time = {
51+
hour = 7,
52+
minute = 32,
53+
nanoSecond = 0,
54+
second = 0
55+
},
56+
timeOffset = { minutes = -420 }
57+
},
58+
time = {
59+
hour = 7,
60+
minute = 32,
61+
nanoSecond = 0,
62+
second = 0
63+
}
64+
}
65+
--]]
66+
```
67+
68+
- Test suite now runs on Windows
69+
70+
### Changed
71+
72+
- Use [luaunit](https://github.com/bluebird75/luaunit) instead of [busted](https://github.com/lunarmodules/busted) for testing
73+
- `quoteDatesAndTimes` now defaults to `false`.
74+
75+
### Fixed
76+
77+
- Boolean values are decoded as booleans instead of integers. (#6)
78+
879
## [0.1.1](https://github.com/LebJe/toml.lua/releases/tag/0.1.1) - 2022-06-14
980

1081
### Added

CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
3131

3232
# compile in release mode by default
3333
if(NOT CMAKE_BUILD_TYPE)
34-
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
34+
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
3535
endif()
3636

3737
include(FetchContent)
@@ -41,23 +41,23 @@ FetchContent_Declare(
4141
GIT_REPOSITORY "https://github.com/marzer/tomlplusplus.git"
4242
GIT_SHALLOW ON
4343
GIT_SUBMODULES ""
44-
GIT_TAG "v3.0.1"
44+
GIT_TAG "v3.3.0"
4545
)
4646

4747
FetchContent_Declare(
4848
${SOL2}
4949
GIT_REPOSITORY "https://github.com/ThePhD/sol2.git"
5050
GIT_SHALLOW ON
5151
GIT_SUBMODULES ""
52-
GIT_TAG "v3.2.3"
52+
GIT_TAG "v3.3.0"
5353
)
5454

5555
FetchContent_Declare(
5656
${MAGIC_ENUM}
5757
GIT_REPOSITORY "https://github.com/Neargye/magic_enum.git"
5858
GIT_SHALLOW ON
5959
GIT_SUBMODULES ""
60-
GIT_TAG "v0.8.0"
60+
GIT_TAG "v0.8.2"
6161
)
6262

6363
FetchContent_GetProperties(${TOML++})
@@ -119,7 +119,8 @@ set(SOURCES
119119
src/toml.cpp
120120
src/decoding/decoding.cpp
121121
src/encoding/encoding.cpp
122-
src/DateAndTime/dateAndTime.cpp
122+
src/DataTypes/DateAndTime/dateAndTime.cpp
123+
src/DataTypes/TOMLInt/TOMLInt.cpp
123124
src/utilities/utilities.cpp
124125
)
125126

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Jeff Lebrun
3+
Copyright (c) 2023 Jeff Lebrun
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)