aboutsummaryrefslogtreecommitdiffstats
path: root/tools/SputnikConverter/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tools/SputnikConverter/Program.cs')
-rw-r--r--tools/SputnikConverter/Program.cs24
1 files changed, 19 insertions, 5 deletions
diff --git a/tools/SputnikConverter/Program.cs b/tools/SputnikConverter/Program.cs
index 626056d24..dc8534411 100644
--- a/tools/SputnikConverter/Program.cs
+++ b/tools/SputnikConverter/Program.cs
@@ -12,6 +12,7 @@ namespace Microsoft.Sputnik.Interop.ParserEngine
{
string source = string.Empty;
string destination = string.Empty;
+ string globalScopeDestination = string.Empty;
if (args == null || args.Length < 2)
{
@@ -19,28 +20,41 @@ namespace Microsoft.Sputnik.Interop.ParserEngine
}
source = args[0];
destination = args[1];
+ if (!Directory.Exists(destination))
+ {
+ Directory.CreateDirectory(destination);
+ }
+
+
+ globalScopeDestination = destination.Remove(destination.LastIndexOf("\\") + 1) + "GlobalScope";
string root = "conformance";
int countInputFiles = 0;
try
{
-
Logger.WriteToLog("Start Time : {0}", DateTime.Now.ToString());
if (Directory.Exists(source))
{
string[] filePaths = Directory.GetFiles(source, "*.js", SearchOption.AllDirectories);
- ES5TestScript.InitGlobals(destination);
+ ES5TestScript.InitGlobals(globalScopeDestination);
foreach (string filePath in filePaths)
{
SputnikTestScript testScript = new SputnikTestScript();
- testScript.Load(filePath);
- ES5TestScript.Save(testScript, root, destination);
+ testScript.Load(filePath, root);
+ if (testScript.IsNegative)
+ {
+ ES5TestScript.Save(testScript, root, globalScopeDestination);
+ }
+ else
+ {
+ ES5TestScript.Save(testScript, root, destination);
+ }
countInputFiles++;
}
- ES5TestScript.UpdateGlobals(destination);
+ ES5TestScript.UpdateGlobals(globalScopeDestination);
}
Logger.WriteToLog(ResourceClass.Total_Input_Files, countInputFiles.ToString());
Logger.WriteToLog(ResourceClass.Total_Output_Files, ES5TestScript.OutputFileCounter.ToString());