From 7b390ce77a9f15e64937410bc78f6668aff475fb Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Wed, 10 Aug 2022 09:45:14 +0200 Subject: [PATCH] Extend tests --- spec/core_spec.moon | 14 +++++--------- spec/fixtures/sub/test.lua | 1 + spec/loaders_spec.moon | 9 +++++++++ 3 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 spec/fixtures/sub/test.lua create mode 100644 spec/loaders_spec.moon diff --git a/spec/core_spec.moon b/spec/core_spec.moon index c6ba06d..85daeda 100644 --- a/spec/core_spec.moon +++ b/spec/core_spec.moon @@ -23,13 +23,9 @@ describe 'core module', -> assert.is.table lua_first.test assert.is.string txt_first.test + + it 'recursively binds to subdirectories', -> + assert.equal 'file in subdirectory', config.sub.test -describe 'raw loader', -> - before_each -> export loader = require 'glass.raw' - it 'loads files as plain text', -> - assert.same 'plain text\n', loader 'spec/fixtures/test' - -describe 'lua loader', -> - before_each -> export loader = require 'glass.lua' - it 'loads Lua files', -> - assert.same { foo: 'bar', tab: {} }, loader 'spec/fixtures/test' + it 'returns nil for missing configs', -> + assert.nil config.missing diff --git a/spec/fixtures/sub/test.lua b/spec/fixtures/sub/test.lua new file mode 100644 index 0000000..1301fa2 --- /dev/null +++ b/spec/fixtures/sub/test.lua @@ -0,0 +1 @@ +return 'file in subdirectory' diff --git a/spec/loaders_spec.moon b/spec/loaders_spec.moon new file mode 100644 index 0000000..656460d --- /dev/null +++ b/spec/loaders_spec.moon @@ -0,0 +1,9 @@ +describe 'raw loader', -> + before_each -> export loader = require 'glass.raw' + it 'loads files as plain text', -> + assert.same 'plain text\n', loader 'spec/fixtures/test' + +describe 'lua loader', -> + before_each -> export loader = require 'glass.lua' + it 'loads Lua files', -> + assert.same { foo: 'bar', tab: {} }, loader 'spec/fixtures/test'