mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-07-31 15:58:27 -04:00
* Move all unit tests to Engine/Tests * Fix Margin.EdgeSubtract * Fix Capsule.Contains * EnvironmentVariables.Remove if it's null * Fixed ray trace never returning startedsolid * Fix HistoryList.Navigate on empty list * Fix GameObject.WorldPosition accepting NaNs * Fix flex: initial expanding to the wrong grow/shrink * Translation.TryConvert shouldn't throw on invalid enum strings * Skip sound file tests on machines with no audio device
35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
using System;
|
|
using System.IO;
|
|
using static Editor.AboutWidget;
|
|
|
|
namespace SystemTests;
|
|
|
|
[TestClass]
|
|
public class ThirdPartyLegalTest
|
|
{
|
|
[TestMethod]
|
|
public void CheckJsonValidity()
|
|
{
|
|
var fileData = File.ReadAllText( "thirdpartylegalnotices/dependency_index.json" );
|
|
var indexData = Json.Deserialize<DependencyIndex>( fileData );
|
|
// If we got this far without an exception, the JSON is valid
|
|
Assert.IsNotNull( indexData );
|
|
Assert.IsTrue( indexData.Components.Any(), "Dependency index deserialized to an empty component list" );
|
|
}
|
|
|
|
[TestMethod]
|
|
public void CheckAllLicensesExist()
|
|
{
|
|
var fileData = File.ReadAllText( "thirdpartylegalnotices/dependency_index.json" );
|
|
var indexData = Json.Deserialize<DependencyIndex>( fileData );
|
|
Assert.IsTrue( indexData.Components.Any(), "Dependency index deserialized to an empty component list" );
|
|
foreach ( var component in indexData.Components )
|
|
{
|
|
// We don't require a license for public domain components
|
|
if ( component.License.ToLower() == "public-domain" || component.License.ToLower() == "proprietary" ) continue;
|
|
var licensePath = Path.Combine( "thirdpartylegalnotices/licenses/", component.Name.ToLower().Replace( " ", "-" ) );
|
|
Assert.IsTrue( File.Exists( licensePath ), $"License file missing: {licensePath}" );
|
|
}
|
|
}
|
|
}
|