mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Added test for adding files during hotload
This commit is contained in:
parent
c08d1161fb
commit
912fdbe195
6 changed files with 95 additions and 0 deletions
5
IDE/Tests/BugW005/BeefProj.toml
Normal file
5
IDE/Tests/BugW005/BeefProj.toml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
FileVersion = 1
|
||||||
|
|
||||||
|
[Project]
|
||||||
|
Name = "Bug"
|
||||||
|
StartupObject = "Bug.Program"
|
6
IDE/Tests/BugW005/BeefSpace.toml
Normal file
6
IDE/Tests/BugW005/BeefSpace.toml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
FileVersion = 1
|
||||||
|
Projects = {Bug = {Path = "."}}
|
||||||
|
|
||||||
|
[Workspace]
|
||||||
|
StartupProject = "Bug"
|
||||||
|
|
7
IDE/Tests/BugW005/Extra.bf
Normal file
7
IDE/Tests/BugW005/Extra.bf
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
static
|
||||||
|
{
|
||||||
|
public static int Extra()
|
||||||
|
{
|
||||||
|
return 123;
|
||||||
|
}
|
||||||
|
}
|
16
IDE/Tests/BugW005/scripts/Test.txt
Normal file
16
IDE/Tests/BugW005/scripts/Test.txt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# This tests that types that fail generic tests don't create types referenced in methods
|
||||||
|
# and also that they get deleted immediately when they are dereferenced.
|
||||||
|
|
||||||
|
ShowFile("src/Program.bf")
|
||||||
|
|
||||||
|
GotoText("//Test_Start")
|
||||||
|
ToggleBreakpoint()
|
||||||
|
RunWithCompiling()
|
||||||
|
|
||||||
|
ToggleCommentAt("CallExtra_Call")
|
||||||
|
AddProjectItem("Bug", "", "$(WorkspaceDir)/Extra.bf")
|
||||||
|
|
||||||
|
Compile()
|
||||||
|
StepInto()
|
||||||
|
StepOver()
|
||||||
|
AssertEvalEquals("val", "123")
|
24
IDE/Tests/BugW005/src/Program.bf
Normal file
24
IDE/Tests/BugW005/src/Program.bf
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#pragma warning disable 168
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
namespace Bug
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
public static void CallExtra()
|
||||||
|
{
|
||||||
|
/*CallExtra_Call
|
||||||
|
int val = Extra();
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
int ig = 111;
|
||||||
|
//Test_Start
|
||||||
|
CallExtra();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2558,5 +2558,42 @@ namespace IDE
|
||||||
valuePtr.Dispose();
|
valuePtr.Dispose();
|
||||||
*valuePtr = Variant.Create<String>(new String(value), true);
|
*valuePtr = Variant.Create<String>(new String(value), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IDECommand]
|
||||||
|
public void AddProjectItem(String projectName, String folderPath, String filePath)
|
||||||
|
{
|
||||||
|
var project = gApp.FindProjectByName(projectName);
|
||||||
|
if (project == null)
|
||||||
|
{
|
||||||
|
mScriptManager.Fail(scope String()..AppendF("Failed to find project '{}'", projectName));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectFolder foundFolder = null;
|
||||||
|
if (folderPath == "")
|
||||||
|
foundFolder = project.mRootFolder;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
project.WithProjectItems(scope [&] (projectItem) =>
|
||||||
|
{
|
||||||
|
if (var projectFolder = projectItem as ProjectFolder)
|
||||||
|
{
|
||||||
|
var relDir = scope String();
|
||||||
|
projectFolder.GetRelDir(relDir);
|
||||||
|
if (Path.Equals(relDir, folderPath))
|
||||||
|
foundFolder = projectFolder;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundFolder == null)
|
||||||
|
{
|
||||||
|
mScriptManager.Fail(scope String()..AppendF("Failed to find project folder '{}'", folderPath));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IDEUtils.FixFilePath(filePath);
|
||||||
|
gApp.mProjectPanel.ImportFiles(foundFolder, scope .(filePath));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue