diff --git a/Dockerfile b/Dockerfile index 7213825..c094194 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,11 +35,14 @@ RUN curl -R -O -L https://luarocks.org/releases/luarocks-${LUAROCKS_VER}.tar.gz RUN luarocks install busted RUN luarocks install alt-getopt RUN luarocks install moonscript +RUN luarocks install date +RUN luarocks install lua-tz +RUN luarocks install luatz FROM ubuntu:24.04 RUN apt-get update && \ - apt-get install -y jq && \ + apt-get install -y jq tzdata && \ rm -rf /var/lib/apt/lists/* && \ apt-get purge --auto-remove && \ apt-get clean diff --git a/README.md b/README.md index 3cc12e0..59e9670 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,14 @@ The Docker image to automatically run tests on [MoonScript](https://github.com/exercism/moonscript) solutions submitted to [Exercism]. +## Added LuaRocks + +For student solutions, these additional luarocks have been added to the test-runner image: + +* [lua-tz](https://luarocks.org/modules/anaef/lua-tz) +* [date](https://luarocks.org/modules/tieske/date) +* [luatz](https://luarocks.org/modules/daurnimator/luatz) + ## Run the test runner To run the tests of a single solution, do the following: diff --git a/tests/can-use-lua-tz/.busted b/tests/can-use-lua-tz/.busted new file mode 100644 index 0000000..86b84e7 --- /dev/null +++ b/tests/can-use-lua-tz/.busted @@ -0,0 +1,5 @@ +return { + default = { + ROOT = { '.' } + } +} diff --git a/tests/can-use-lua-tz/can_use_lua_tz.moon b/tests/can-use-lua-tz/can_use_lua_tz.moon new file mode 100644 index 0000000..02b2455 --- /dev/null +++ b/tests/can-use-lua-tz/can_use_lua_tz.moon @@ -0,0 +1,8 @@ +tz = require 'tz' + +utc_time = -> + timespec = year: 2014, month: 11, day: 1, hour: 20 + zone = 'UTC' + tz.time timespec, zone + +utc_time diff --git a/tests/can-use-lua-tz/can_use_lua_tz_spec.moon b/tests/can-use-lua-tz/can_use_lua_tz_spec.moon new file mode 100644 index 0000000..9bf6028 --- /dev/null +++ b/tests/can-use-lua-tz/can_use_lua_tz_spec.moon @@ -0,0 +1,5 @@ +utc_time = require 'can_use_lua_tz' + +describe 'one test', -> + it 'test time in UTC', -> + assert.are.equal 1414872000, utc_time! diff --git a/tests/can-use-lua-tz/expected_results.json b/tests/can-use-lua-tz/expected_results.json new file mode 100644 index 0000000..bcb7531 --- /dev/null +++ b/tests/can-use-lua-tz/expected_results.json @@ -0,0 +1 @@ +{"tests":[{"status":"pass","name":"test time in UTC","test_code":" assert.are.equal 1414872000, utc_time!"}],"status":"pass","version":2}