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

@ -24,12 +24,8 @@ describe 'core module', ->
assert.is.table lua_first.test assert.is.table lua_first.test
assert.is.string txt_first.test assert.is.string txt_first.test
describe 'raw loader', -> it 'recursively binds to subdirectories', ->
before_each -> export loader = require 'glass.raw' assert.equal 'file in subdirectory', config.sub.test
it 'loads files as plain text', ->
assert.same 'plain text\n', loader 'spec/fixtures/test'
describe 'lua loader', -> it 'returns nil for missing configs', ->
before_each -> export loader = require 'glass.lua' assert.nil config.missing
it 'loads Lua files', ->
assert.same { foo: 'bar', tab: {} }, loader 'spec/fixtures/test'

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'