Extend tests

This commit is contained in:
Talia 2022-08-10 09:45:14 +02:00
parent 15b627dfce
commit 7b390ce77a
3 changed files with 15 additions and 9 deletions

View file

@ -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

1
spec/fixtures/sub/test.lua vendored Normal file
View file

@ -0,0 +1 @@
return 'file in subdirectory'

9
spec/loaders_spec.moon Normal file
View file

@ -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'