-
Notifications
You must be signed in to change notification settings - Fork 520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interpreter=busted fails to debug busted script #552
Comments
@ildar, does this only happen when you are debugging the script? When you are using |
Indeed Running works fine.
|
I think this is caused by one level of indirection that the IDE needs to setup for debugging to work, but this fails because Basically, create One workaround is to use Run if you don't need to debug and add |
@ildar, what Lua version are you using to run busted? |
5.1 classic lua interpreter (system, installed to /usr/bin/lua)
|
@ildar, can you try the following diff: diff --git a/interpreters/busted.lua b/interpreters/busted.lua
index 0fb271e..45f1213 100644
--- a/interpreters/busted.lua
+++ b/interpreters/busted.lua
@@ -29,35 +29,28 @@ return {
end
end
- local file
+ local file = wfilename:GetFullPath()
+ local helper
if rundebug then
-- start running the application right away
- DebuggerAttachDefault({runstart = ide.config.debugger.runonstart == true})
- local code = (
-[=[xpcall(function() io.stdout:setvbuf('no')
- require('mobdebug').start(); dofile [[%s]]
- end, function(err) print(debug.traceback(err)) end)]=])
- :format(wfilename:GetFullPath())
+ DebuggerAttachDefault({runstart = ide.config.debugger.runonstart ~= false})
local tmpfile = wx.wxFileName()
tmpfile:AssignTempFileName(".")
- file = tmpfile:GetFullPath()
- local f = io.open(file, "w")
+ helper = tmpfile:GetFullPath()..".lua" -- busted likes .lua files more than .tmp files
+ local f = io.open(helper, "w")
if not f then
- DisplayOutputLn("Can't open temporary file '"..file.."' for writing.")
+ DisplayOutputLn("Can't open temporary file '"..helper.."' for writing.")
return
end
- f:write(code)
+ f:write("require('mobdebug').start()")
f:close()
end
- file = file or wfilename:GetFullPath()
-
- local options = ide.config.busted and ide.config.busted.options
- or "--output=TAP"
- local cmd = ('"%s" %s "%s"'):format(busted, options, file)
- -- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
+ local options = ide.config.busted and ide.config.busted.options or "--output=TAP"
+ local cmd = ('"%s" %s %s "%s"'):format(busted, options, helper and "--helper="..helper or "", file)
+ -- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
return CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil,
- function() if rundebug then wx.wxRemoveFile(file) end end)
+ function() if helper then wx.wxRemoveFile(helper) end end)
end,
hasdebugger = true,
fattachdebug = function(self) DebuggerAttachDefault() end, It should fix debugging for the scripts (but you need to set a breakpoint if you want to stop in the script or use |
yep, works as you say. Thanks!
|
@ildar, pushed the changes; thanks for the report! |
Simple
https://github.com/Olivine-Labs/busted/blob/master/spec/test_runner/interface_spec.lua
in ZBS:
I don't understand this output.
But running in the console shows correctly:
The text was updated successfully, but these errors were encountered: