mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 08:05:45 +00:00
ZoneCodeGenerator: Fix wrong exception being thrown in tests: Use TestFailedException instead of LoadingException
This commit is contained in:
parent
825b14bfd4
commit
9b12bd7e41
@ -33,18 +33,18 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests
|
|||||||
var assetType = state.Repository.GetDataTypeByName(assetTypeName);
|
var assetType = state.Repository.GetDataTypeByName(assetTypeName);
|
||||||
if (assetType == null)
|
if (assetType == null)
|
||||||
{
|
{
|
||||||
throw new LoadingException($"Could not find type '{assetTypeName}' to mark it as an asset.");
|
throw new TestFailedException($"Could not find type '{assetTypeName}' to mark it as an asset.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(assetType is DataTypeWithMembers assetTypeWithMembers))
|
if (!(assetType is DataTypeWithMembers assetTypeWithMembers))
|
||||||
{
|
{
|
||||||
throw new LoadingException($"Type of asset '{assetTypeName}' needs to be struct or union.");
|
throw new TestFailedException($"Type of asset '{assetTypeName}' needs to be struct or union.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var assetInfo = state.Repository.GetInformationFor(assetTypeWithMembers);
|
var assetInfo = state.Repository.GetInformationFor(assetTypeWithMembers);
|
||||||
if (assetInfo == null)
|
if (assetInfo == null)
|
||||||
{
|
{
|
||||||
throw new LoadingException($"Could not find information for type '{assetTypeName}' to mark it as an asset.");
|
throw new TestFailedException($"Could not find information for type '{assetTypeName}' to mark it as an asset.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var enumEntryName = NextMatch(AssetEnumEntryToken);
|
var enumEntryName = NextMatch(AssetEnumEntryToken);
|
||||||
@ -52,7 +52,7 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests
|
|||||||
.SelectMany(_enum => _enum.Members)
|
.SelectMany(_enum => _enum.Members)
|
||||||
.FirstOrDefault(member => member.Name.Equals(enumEntryName, StringComparison.CurrentCultureIgnoreCase));
|
.FirstOrDefault(member => member.Name.Equals(enumEntryName, StringComparison.CurrentCultureIgnoreCase));
|
||||||
|
|
||||||
assetInfo.AssetEnumEntry = enumEntry ?? throw new LoadingException(
|
assetInfo.AssetEnumEntry = enumEntry ?? throw new TestFailedException(
|
||||||
$"Could not find enum entry '{enumEntryName}' as an asset type index for asset type '{assetTypeName}'.");
|
$"Could not find enum entry '{enumEntryName}' as an asset type index for asset type '{assetTypeName}'.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,12 +27,12 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests
|
|||||||
|
|
||||||
if (dataTypeToUse == null)
|
if (dataTypeToUse == null)
|
||||||
{
|
{
|
||||||
throw new LoadingException($"Could not find data type '{typeName}'");
|
throw new TestFailedException($"Could not find data type '{typeName}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dataTypeToUse is DataTypeWithMembers dataTypeWithMembersToUse))
|
if (!(dataTypeToUse is DataTypeWithMembers dataTypeWithMembersToUse))
|
||||||
{
|
{
|
||||||
throw new LoadingException($"To use data type '{typeName}' it must either be a struct or a union.");
|
throw new TestFailedException($"To use data type '{typeName}' it must either be a struct or a union.");
|
||||||
}
|
}
|
||||||
|
|
||||||
state.DataTypeInUse = dataTypeWithMembersToUse;
|
state.DataTypeInUse = dataTypeWithMembersToUse;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user