-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added necessary mv and rm commands on Windows
Fixed the tests
- Loading branch information
1 parent
80e7fc3
commit 73f2e43
Showing
17 changed files
with
199 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
Source/IntegrationTests/TestFiles/LitTests/LitTest/gomodule/multimodule/test.doo
Binary file not shown.
8 changes: 4 additions & 4 deletions
8
...ce/IntegrationTests/TestFiles/LitTests/LitTest/pythonmodule/multimodule/DerivedModule.dfy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...IntegrationTests/TestFiles/LitTests/LitTest/pythonmodule/multimodule/PythonModule1-py.dtr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
file_format_version = "1.0" | ||
dafny_version = "4.7.0.0" | ||
dafny_version = "4.8.0.0" | ||
[options_by_module.DafnyModule1] | ||
python-module-name = "PythonModule1" |
Binary file modified
BIN
+0 Bytes
(100%)
...ce/IntegrationTests/TestFiles/LitTests/LitTest/pythonmodule/multimodule/PythonModule1.doo
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
...ationTests/TestFiles/LitTests/LitTest/pythonmodule/multimodule/dafnysource/helloworld.dfy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// This file is used to regenerate PythonModule1.doo | ||
// RUN: echo 'lit should ignore this file' | ||
|
||
module DafnyModule1 { | ||
method HelloWorld() | ||
{ | ||
print "Hello World"; | ||
} | ||
} |
Binary file modified
BIN
-101 Bytes
(87%)
...ntegrationTests/TestFiles/LitTests/LitTest/pythonmodule/nestedmodule/SomeNestedModule.doo
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
...Files/LitTests/LitTest/pythonmodule/nestedmodule/SomeNestedModule/SomeNestedModule-py.dtr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
file_format_version = "1.0" | ||
dafny_version = "4.7.0.0" | ||
dafny_version = "4.8.0.0" | ||
[options_by_module."Some.Nested.Module"] | ||
python-module-name = "SomeNestedModule" |
4 changes: 2 additions & 2 deletions
4
.../IntegrationTests/TestFiles/LitTests/LitTest/pythonmodule/nestedmodule/SomeTestModule.dfy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...sts/TestFiles/LitTests/LitTest/pythonmodule/nestedmodule/dafnysource/SomeNestedModule.dfy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// This file is used to regenerate SomeNestedModule.doo | ||
// RUN: echo 'lit should ignore this file' | ||
|
||
module Some.Nested.Module { | ||
method HelloWorld() | ||
{ | ||
print "Hello World"; | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
...tionTests/TestFiles/LitTests/LitTest/pythonmodule/singlemodule/dafnysource/helloworld.dfy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.IO; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
using Xunit.Sdk; | ||
|
||
namespace XUnitExtensions.Lit { | ||
public class MvCommand : ILitCommand { | ||
|
||
private readonly string fileOrFolder; | ||
private readonly string destination; | ||
|
||
private MvCommand(string fileOrFolder, string destination) { | ||
this.fileOrFolder = fileOrFolder; | ||
this.destination = destination; | ||
} | ||
|
||
public static ILitCommand Parse(string[] args) { | ||
if (args.Length != 2) { | ||
throw new ArgumentException($"Wrong number of arguments for mv, expected 2 but got {args.Length}"); | ||
} | ||
var fileOrFolder = args[0]; | ||
var destination = args[1]; | ||
|
||
return new MvCommand(fileOrFolder, destination); | ||
} | ||
|
||
public async Task<int> Execute(TextReader inputReader, | ||
TextWriter outputWriter, TextWriter errorWriter) { | ||
if (File.Exists(fileOrFolder)) { | ||
try { | ||
File.Move(fileOrFolder, destination); | ||
} catch (Exception e) { | ||
await outputWriter.WriteLineAsync(e.ToString()); | ||
return 1; | ||
} | ||
} else if (Directory.Exists(fileOrFolder)) { | ||
try { | ||
Directory.Move(fileOrFolder, destination); | ||
} catch (Exception e) { | ||
await outputWriter.WriteLineAsync(e.ToString()); | ||
return 1; | ||
} | ||
} else { | ||
throw new ArgumentException("File " + fileOrFolder + " not found"); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
public override string ToString() { | ||
return $"%mv {fileOrFolder} {destination}"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
using Xunit.Sdk; | ||
|
||
namespace XUnitExtensions.Lit { | ||
public class RmCommand : ILitCommand { | ||
|
||
private readonly string options; | ||
private readonly string fileOrFolder; | ||
|
||
private RmCommand(string options, string fileOrFolder) { | ||
this.options = options; | ||
this.fileOrFolder = fileOrFolder; | ||
} | ||
|
||
public static ILitCommand Parse(string[] args) { | ||
if (args.Length != 1 && args.Length != 2) { | ||
throw new ArgumentException($"Wrong number of arguments for rm, expected 1 or 2 but got {args.Length}"); | ||
} | ||
|
||
string fileOrFolder; | ||
string options; | ||
if (args.Length == 2) { | ||
options = args[0]; | ||
fileOrFolder = args[1]; | ||
} else { | ||
options = ""; | ||
fileOrFolder = args[0]; | ||
} | ||
|
||
return new RmCommand(options, fileOrFolder); | ||
} | ||
private static void RecursiveDelete(DirectoryInfo baseDir) | ||
{ | ||
if (!baseDir.Exists) { | ||
return; | ||
} | ||
|
||
foreach (var dir in baseDir.EnumerateDirectories()) { | ||
RecursiveDelete(dir); | ||
} | ||
baseDir.Delete(true); | ||
} | ||
public async Task<int> Execute(TextReader inputReader, | ||
TextWriter outputWriter, TextWriter errorWriter) { | ||
if (File.Exists(fileOrFolder)) { | ||
try { | ||
File.Delete(fileOrFolder); | ||
} catch (Exception e) { | ||
await outputWriter.WriteLineAsync(e.ToString()); | ||
return 1; | ||
} | ||
} else if (Directory.Exists(fileOrFolder)) { | ||
if (Directory.EnumerateFiles(fileOrFolder).Any()) { | ||
if (options == "-rf") { | ||
RecursiveDelete(new DirectoryInfo(fileOrFolder)); | ||
} else { | ||
await outputWriter.WriteLineAsync("Directory is not empty. Please supply rm with -rf to force deletion"); | ||
return 1; | ||
} | ||
} else { | ||
try { | ||
Directory.Delete(fileOrFolder); | ||
} catch (Exception e) { | ||
await outputWriter.WriteLineAsync(e.ToString()); | ||
return 1; | ||
} | ||
} | ||
} else { | ||
await outputWriter.WriteLineAsync($"File or folder {fileOrFolder} not found"); | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
public override string ToString() { | ||
return $"%rm {(options != "" ? options + " " : "")}{fileOrFolder}"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters