From 85117d6f7cca5dbc1735928ed98f6fac8bad8a39 Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Tue, 7 Nov 2017 18:03:39 -0800 Subject: [PATCH] Spec work, not quite finished --- .gitignore | 3 ++- .travis.yml | 29 +++++++++++++++++++++++++++++ install-dependencies | 3 +++ install-dependencies.bat | 3 +++ lib/init.lua | 17 +++++++++++++++++ spec.lua | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 .travis.yml create mode 100644 install-dependencies create mode 100644 install-dependencies.bat create mode 100644 lib/init.lua create mode 100644 spec.lua diff --git a/.gitignore b/.gitignore index 903a70b..588557b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /luacov.* -/testez-installer.lua \ No newline at end of file +/testez-installer.lua +/modules \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3c4a945 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,29 @@ +# http://kiki.to/blog/2016/02/04/talk-continuous-integration-with-lua/ +language: python +sudo: false + +branches: + only: + - master + +env: + - LUA="lua=5.1" + +before_install: + - pip install hererocks + - hererocks lua_install -r^ --$LUA + - export PATH=$PATH:$PWD/lua_install/bin + +install: + - luarocks install busted + - luarocks install luacov + - luarocks install luacov-coveralls + - luarocks install luacheck + - ./install-dependencies + +script: + - luacheck lib + - lua -lluacov spec.lua + +after_success: + - luacov-coveralls -e $TRAVIS_BUILD_DIR/lua_install \ No newline at end of file diff --git a/install-dependencies b/install-dependencies new file mode 100644 index 0000000..0a9922b --- /dev/null +++ b/install-dependencies @@ -0,0 +1,3 @@ +#!/bin/sh + +git clone --depth=1 https://github.com/LPGhatguy/lemur.git modules/lemur \ No newline at end of file diff --git a/install-dependencies.bat b/install-dependencies.bat new file mode 100644 index 0000000..a33231b --- /dev/null +++ b/install-dependencies.bat @@ -0,0 +1,3 @@ +@echo off + +git clone --depth=1 https://github.com/LPGhatguy/lemur.git modules/lemur \ No newline at end of file diff --git a/lib/init.lua b/lib/init.lua new file mode 100644 index 0000000..cebacfb --- /dev/null +++ b/lib/init.lua @@ -0,0 +1,17 @@ +local TestEZ = { + Expectation = require(script.Expectation), + TestBootstrap = require(script.TestBootstrap), + TestEnum = require(script.TestEnum), + TestPlan = require(script.TestPlan), + TestPlanBuilder = require(script.TestPlanBuilder), + TestPlanner = require(script.TestPlanner), + TestResults = require(script.TestResults), + TestRunner = require(script.TestRunner), + TestSession = require(script.TestSession), + + Reporters = { + TextReporter = require(script.Reporters.TextReporter), + }, +} + +return TestEZ \ No newline at end of file diff --git a/spec.lua b/spec.lua new file mode 100644 index 0000000..230f95e --- /dev/null +++ b/spec.lua @@ -0,0 +1,33 @@ +local lemur = require("modules.lemur") + +local habitat = lemur.Habitat.new() + +local Rodux = lemur.Instance.new("Folder") +Rodux.Name = "Rodux" +habitat:loadFromFs("lib", Rodux) + +-- Simulate rbxpacker's 'collapse' mechanism +do + local newRoot = Rodux:FindFirstChild("init") + newRoot.Name = Rodux.Name + newRoot.Parent = nil + + for _, child in ipairs(Rodux:GetChildren()) do + child.Parent = newRoot + end + + Rodux = newRoot +end + +local TestEZ = lemur.Instance.new("Folder") +TestEZ.Name = "TestEZ" +habitat:loadFromFs("modules/testez/lib", TestEZ) + +local TestBootstrap = habitat:require(TestEZ.TestBootstrap) +local TextReporter = habitat:require(TestEZ.Reporters.TextReporter) + +local results = TestBootstrap:run(Rodux, TextReporter) + +if results.failureCount > 0 then + os.exit(1) +end \ No newline at end of file