-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* it is in Perl instead of Shell * it is aware of current working directory * can run tests in different folders * can load code in different folders example: ```shell bin/busted -C examples/cors ``` or from within different directory: ```shell ../../bin/busted ```
- Loading branch information
Showing
4 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
local path = require('pl.path') | ||
local root = path.currentdir() | ||
|
||
return { | ||
_all = { | ||
helper = 'spec/spec_helper.lua', | ||
helper = path.join(root, 'spec/spec_helper.lua'), | ||
}, | ||
default = { | ||
verbose = true, | ||
['shuffle-tests'] = true, | ||
['shuffle-files'] = true, | ||
lpath = "./spec/?.lua;./apicast/src/?.lua;" | ||
lpath = path.join(root, 'spec/?.lua;') .. path.join(root, 'apicast/src/?.lua;'), | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
#!/usr/bin/env sh | ||
#!/usr/bin/env perl | ||
|
||
exec resty --http-include spec/fixtures/echo.conf bin/busted.lua "$@" | ||
use File::Basename; | ||
use Cwd; | ||
|
||
my $dirname = dirname(__FILE__); | ||
my $cwd = getcwd(); | ||
|
||
chdir "$dirname/.."; | ||
|
||
my $apicast = getcwd(); | ||
|
||
exec '/usr/bin/env', 'resty', | ||
'--http-include', "$apicast/spec/fixtures/echo.conf", | ||
"$apicast/bin/busted.lua", | ||
'--config-file', "$apicast/.busted", | ||
'--directory', "$cwd", | ||
@ARGV; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
local _M = require 'cors' | ||
|
||
describe('cors', function() | ||
it('is', function() | ||
assert.match('CORS', _M._NAME) | ||
end) | ||
end) |