mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
test(Godot): 添加项目元数据生成器测试
- 验证基于 project.godot 的 AutoLoad 和 Input Action 强类型入口生成 - 测试 AutoLoad 类型非节点继承时的诊断报告功能 - 验证 Input Action 标识符冲突时的后缀追加和警告机制 - 测试多个显式映射指向同一 AutoLoad 时的重复检测 - 验证不同命名空间同名节点类型的隐式映射冲突处理 - 测试 AutoLoad 和 Input Action 重复条目的诊断和保留逻辑 - 验证缺失或空 project.godot 文件时的无生成行为
This commit is contained in:
parent
bb7abc0d8f
commit
31a439e184
@ -463,6 +463,66 @@ public class GodotProjectMetadataGeneratorTests
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证缺少 <c>project.godot</c> AdditionalText 时不会生成任何源码或诊断。
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Run_Should_Not_Generate_Sources_When_Project_File_Is_Missing()
|
||||
{
|
||||
var result = AdditionalTextGeneratorTestDriver.Run<GodotProjectMetadataGenerator>(
|
||||
CreateSource("namespace TestApp { }"));
|
||||
|
||||
var generatorResult = result.Results.Single();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(generatorResult.Diagnostics, Is.Empty);
|
||||
Assert.That(generatorResult.GeneratedSources, Is.Empty);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证空的 <c>project.godot</c> 内容不会生成任何源码或诊断。
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Run_Should_Not_Generate_Sources_When_Project_File_Is_Empty()
|
||||
{
|
||||
var result = RunGenerator(
|
||||
CreateSource("namespace TestApp { }"),
|
||||
string.Empty);
|
||||
|
||||
var generatorResult = result.Results.Single();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(generatorResult.Diagnostics, Is.Empty);
|
||||
Assert.That(generatorResult.GeneratedSources, Is.Empty);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证只有空节的 <c>project.godot</c> 不会生成任何源码或诊断。
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Run_Should_Not_Generate_Sources_When_Project_File_Has_Empty_Sections()
|
||||
{
|
||||
var result = RunGenerator(
|
||||
CreateSource("namespace TestApp { }"),
|
||||
"""
|
||||
[autoload]
|
||||
|
||||
[input]
|
||||
""");
|
||||
|
||||
var generatorResult = result.Results.Single();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(generatorResult.Diagnostics, Is.Empty);
|
||||
Assert.That(generatorResult.GeneratedSources, Is.Empty);
|
||||
});
|
||||
}
|
||||
|
||||
private static GeneratorDriverRunResult RunGenerator(
|
||||
string source,
|
||||
string projectFile)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user