Skip to content

Commit

Permalink
Enable Symbol and RegExp tests and fix issues (#693)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma committed Jan 17, 2020
1 parent 4544bdb commit 2289f9c
Show file tree
Hide file tree
Showing 810 changed files with 9,732 additions and 4,569 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
@@ -1,3 +1,6 @@
# Auto detect text files and perform LF normalization
* text=auto

Jint.Tests/** linguist-vendored
Jint.Tests.Ecma/** linguist-vendored
Jint.Tests.CommonScripts/** linguist-vendored
Expand Down
2 changes: 1 addition & 1 deletion Jint.Benchmark/DromaeoBenchmark.cs
Expand Up @@ -16,7 +16,7 @@ public class DromaeoBenchmark
{"dromaeo-object-array", null},
{"dromaeo-object-regexp", null},
{"dromaeo-object-string", null},
//{"dromaeo-string-base64", null}
{"dromaeo-string-base64", null}
};

private Engine engine;
Expand Down
37 changes: 17 additions & 20 deletions Jint.Tests.Ecma/EcmaTest.cs
Expand Up @@ -154,15 +154,27 @@ public abstract class EcmaTest
{
private static string _lastError;
private static string staSource;
protected Action<string> Error = s => { _lastError = s; };
protected string BasePath;
private static readonly string BasePath;
private static readonly List<SourceFile> _sourceFiles = new List<SourceFile>(10_000);

public EcmaTest()
static EcmaTest()
{
var assemblyPath = new Uri(typeof(EcmaTest).GetTypeInfo().Assembly.CodeBase).LocalPath;
var assemblyDirectory = new FileInfo(assemblyPath).Directory;

BasePath = assemblyDirectory.Parent.Parent.Parent.FullName;

var localPath = assemblyDirectory.Parent.Parent.Parent.FullName;

var fixturesPath = Path.Combine(localPath, @"TestCases\alltests.json");

var content = File.ReadAllText(fixturesPath);
var doc = JArray.Parse(content);
var path = Path.Combine(localPath, "TestCases");

foreach (var jToken in doc)
{
_sourceFiles.Add(new SourceFile((JObject) jToken, path));
}
}

protected void RunTestInternal(SourceFile sourceFile)
Expand Down Expand Up @@ -231,22 +243,9 @@ protected void RunTestCode(string code, bool negative)

public static IEnumerable<object[]> SourceFiles(string prefix, bool skipped)
{
var assemblyPath = new Uri(typeof(EcmaTest).GetTypeInfo().Assembly.CodeBase).LocalPath;
var assemblyDirectory = new FileInfo(assemblyPath).Directory;

var localPath = assemblyDirectory.Parent.Parent.Parent.FullName;

var fixturesPath = Path.Combine(localPath, @"TestCases\alltests.json");

var content = File.ReadAllText(fixturesPath);
var doc = JArray.Parse(content);
var results = new List<object[]>();
var path = Path.Combine(localPath, "TestCases");

foreach(JObject entry in doc)
foreach(var sourceFile in _sourceFiles)
{
var sourceFile = new SourceFile(entry, path);

if (prefix != null && !sourceFile.Source.StartsWith(prefix))
{
continue;
Expand All @@ -273,7 +272,6 @@ public class SourceFile : IXunitSerializable
{
public SourceFile()
{

}

public SourceFile(JObject node, string basePath)
Expand Down Expand Up @@ -310,6 +308,5 @@ public override string ToString()
return Source;
}
}

}
}

0 comments on commit 2289f9c

Please sign in to comment.