Make print() script function changeable, defaults to Console.WriteLine
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using PorygonSharp;
|
||||
@@ -122,11 +123,26 @@ namespace PorygonSharpTests
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPrint()
|
||||
{
|
||||
using (var script = new Script("print('test')"))
|
||||
{
|
||||
using (var sw = new StringWriter())
|
||||
{
|
||||
Console.SetOut(sw);
|
||||
Assert.False(script.Diagnostics.HasErrors());
|
||||
script.Evaluate();
|
||||
var s = sw.ToString();
|
||||
Assert.AreEqual("test\n", s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHash()
|
||||
{
|
||||
var hash = HashedString.ScriptHash("Foo");
|
||||
var hash = "Foo".ScriptHash();
|
||||
Assert.AreEqual(193501609, hash);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user