mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 12:30:32 +00:00
60 lines
2.3 KiB
C#
60 lines
2.3 KiB
C#
using System;
|
|
using System.IO;
|
|
using ApprovalTests;
|
|
using ApprovalTests.Reporters;
|
|
using Cosmos.Compiler.TestsBase;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
namespace Cosmos.Compiler.Tests
|
|
{
|
|
[TestClass]
|
|
[UseReporter(typeof(VisualStudioReporter))]
|
|
public class DoTest : BaseTest
|
|
{
|
|
[TestMethod]
|
|
[TestCategory("Compiler")]
|
|
public void SimpleWriteLineTest()
|
|
{
|
|
// these files contain the output to be verified. don't clean them.
|
|
var xOutputFile = Path.GetTempFileName();
|
|
var xLogFile = Path.GetTempFileName();
|
|
|
|
var xRunner = new CompilerRunner();
|
|
|
|
xRunner.References.Add(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);
|
|
xRunner.References.Add(typeof(Cosmos.System.Plugs.System.TypeImpl).Assembly.Location);
|
|
xRunner.References.Add(typeof(Cosmos.Core.Plugs.CPUImpl).Assembly.Location);
|
|
xRunner.References.Add(typeof(Cosmos.Debug.Kernel.Plugs.DebugBreak).Assembly.Location);
|
|
|
|
xRunner.AssemblerLogFile = xLogFile;
|
|
xRunner.OutputFile = xOutputFile;
|
|
xRunner.Execute();
|
|
|
|
Verify("Output", File.ReadAllText(xOutputFile));
|
|
Verify("Logfile", File.ReadAllText(xLogFile));
|
|
}
|
|
|
|
[TestMethod]
|
|
[TestCategory("Compiler")]
|
|
public void InterfacesTest()
|
|
{
|
|
// these files contain the output to be verified. don't clean them.
|
|
var xOutputFile = Path.GetTempFileName();
|
|
var xLogFile = Path.GetTempFileName();
|
|
|
|
var xRunner = new CompilerRunner();
|
|
|
|
xRunner.References.Add(typeof(Cosmos.Compiler.Tests.Interfaces.Kernel.Kernel).Assembly.Location);
|
|
xRunner.References.Add(typeof(Cosmos.System.Plugs.System.TypeImpl).Assembly.Location);
|
|
xRunner.References.Add(typeof(Cosmos.Core.Plugs.CPUImpl).Assembly.Location);
|
|
xRunner.References.Add(typeof(Cosmos.Debug.Kernel.Plugs.DebugBreak).Assembly.Location);
|
|
|
|
xRunner.AssemblerLogFile = xLogFile;
|
|
xRunner.OutputFile = xOutputFile;
|
|
xRunner.Execute();
|
|
|
|
Verify("Output", File.ReadAllText(xOutputFile));
|
|
Verify("Logfile", File.ReadAllText(xLogFile));
|
|
}
|
|
}
|
|
}
|