Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e725bcb
Added --qsharp-version option.
ScottCarda-MS Oct 4, 2021
1d2b65e
Changed the checker to be specific to array syntax.
ScottCarda-MS Oct 4, 2021
23e3b41
small change
ScottCarda-MS Oct 4, 2021
3249b99
Merge branch 'main' into sccarda/Versioning
ScottCarda-MS Oct 5, 2021
d782dbd
style
ScottCarda-MS Oct 5, 2021
727d997
draft for getting the Q# files in a project given the project file path
Oct 5, 2021
f8158d1
WIP: Fixed issue with relative paths to inputs, got version from proj…
ScottCarda-MS Oct 6, 2021
5557629
merged in versioning logic
ScottCarda-MS Oct 7, 2021
4e5a72d
updating command line parsing
Oct 8, 2021
7ff76d6
Revert "updating command line parsing"
ScottCarda-MS Oct 9, 2021
74c7c6f
Change command line framework.
ScottCarda-MS Oct 8, 2021
a860e68
tried to consolidate the error throwing logic
ScottCarda-MS Oct 9, 2021
f9988e5
removed some duplication
ScottCarda-MS Oct 11, 2021
8b4ad67
Removed standard input from the tests.
ScottCarda-MS Oct 11, 2021
a5ce089
Removed old unused tests materials and added a test project.
ScottCarda-MS Oct 11, 2021
d3ee17d
WIP
ScottCarda-MS Oct 11, 2021
4c738fc
fixed project test
ScottCarda-MS Oct 11, 2021
e9880ce
Moved cmd to new file
ScottCarda-MS Oct 11, 2021
f994804
Fixed proj file
ScottCarda-MS Oct 11, 2021
2720926
Merge branch 'main' into beheim/msbuildFormatter
ScottCarda-MS Oct 12, 2021
da42f7c
Cleaned up the CommandLineArguments.fs file.
ScottCarda-MS Oct 12, 2021
c809f45
sorted open statements
ScottCarda-MS Oct 12, 2021
b1467e1
Added fsi files back into the App project to ensure restrictive acces…
ScottCarda-MS Oct 12, 2021
2ac7132
Added 'Shows syntax errors' test.
ScottCarda-MS Oct 12, 2021
cc455a7
fantomas
ScottCarda-MS Oct 12, 2021
96b1a0c
Merge branch 'main' into beheim/msbuildFormatter
ScottCarda-MS Oct 12, 2021
83fe02e
fixed fsi
ScottCarda-MS Oct 12, 2021
664d3e6
Added tests for project handling.
ScottCarda-MS Oct 13, 2021
f942b07
Changed name
ScottCarda-MS Oct 13, 2021
cdc167a
fantomas
ScottCarda-MS Oct 13, 2021
1d6a758
Added reference to external file to test projects.
ScottCarda-MS Oct 13, 2021
bdb6e53
Added project references to test projects.
ScottCarda-MS Oct 13, 2021
4258890
Prevent qdk versions older than 0.16.2104.138035 from being updated.
ScottCarda-MS Oct 13, 2021
ed876ad
Added test for erroring on older versions of the Qdk. The OldApplicat…
ScottCarda-MS Oct 13, 2021
381f963
Not sure yet how to discriminate between old and current types of pro…
ScottCarda-MS Oct 14, 2021
e2914b2
fantomas
ScottCarda-MS Oct 14, 2021
48fba97
Add package references to the test projects.
ScottCarda-MS Oct 14, 2021
fcd8cc0
fixed check and associated test for non-quantum.sdk projects.
ScottCarda-MS Oct 14, 2021
7223e76
fantomas
ScottCarda-MS Oct 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions QsFmt.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,9 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Formatter", "src\QsFmt\Form
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "App", "src\QsFmt\App\App.fsproj", "{68F54AEE-C852-4FFA-831D-5BA741BE893E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4399BDF1-685A-4373-8748-142C835A52D6}"
ProjectSection(SolutionItems) = preProject
README.md = src\QsFmt\README.md
EndProjectSection
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Formatter.Tests", "src\QsFmt\Formatter.Tests\Formatter.Tests.fsproj", "{FC9E2BEC-F15F-4818-B0E1-805EA554269E}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Formatter.Tests", "src\QsFmt\Formatter.Tests\Formatter.Tests.fsproj", "{FC9E2BEC-F15F-4818-B0E1-805EA554269E}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "App.Tests", "src\QsFmt\App.Tests\App.Tests.fsproj", "{E00FA726-F852-4D14-90F8-1B0E3E08D822}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "App.Tests", "src\QsFmt\App.Tests\App.Tests.fsproj", "{E00FA726-F852-4D14-90F8-1B0E3E08D822}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
150 changes: 142 additions & 8 deletions src/QsFmt/App.Tests/App.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,33 +1,167 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Microsoft.Quantum.QsFmt.App.Tests</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
</PropertyGroup>

<ItemGroup>
<Content Include="Examples\Example1.qs" CopyToOutputDirectory="PreserveNewest" />
<Content Include="Examples\SyntaxError.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\Example1.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\Example2.qs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\SubExamples1\SubExample1.qs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\SubExamples1\SubExample2.qs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\SubExamples2\SubExample3.qs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\SubExamples2\NestedExamples\NestedExample1.qs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\SubExamples2\NestedExamples\NestedExample2.qs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestTarget\TestTarget.csproj">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestTarget\Program.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestTarget\Included.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestTarget\Excluded1.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestTarget\Excluded2.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleApplication\QSharpApplication1.csproj">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleApplication\Program.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleApplication\Included1.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleApplication\Excluded1.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleApplication\SubFolder1\Included2.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleApplication\SubFolder1\Excluded2.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleApplication\SubFolder1\SubSubFolder\Included4.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleApplication\SubFolder1\SubSubFolder\Excluded4.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleApplication\SubFolder2\Included3.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleApplication\SubFolder2\Excluded3.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleLibrary\QSharpLibrary1.csproj">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleLibrary\Library.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleLibrary\Included1.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleLibrary\Excluded1.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleLibrary\SubFolder1\Included2.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleLibrary\SubFolder1\Excluded2.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleLibrary\SubFolder1\SubSubFolder\Included4.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleLibrary\SubFolder1\SubSubFolder\Excluded4.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleLibrary\SubFolder2\Included3.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleLibrary\SubFolder2\Excluded3.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleTestProject\QSharpTestProject1.csproj">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleTestProject\Tests.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleTestProject\Included1.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleTestProject\Excluded1.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleTestProject\SubFolder1\Included2.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleTestProject\SubFolder1\Excluded2.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleTestProject\SubFolder1\SubSubFolder\Included4.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleTestProject\SubFolder1\SubSubFolder\Excluded4.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleTestProject\SubFolder2\Included3.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\SimpleTestProject\SubFolder2\Excluded3.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\ReferenceLibrary\ReferenceLibrary.csproj">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\ReferenceLibrary\Library.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\OldApplication\OldApplication.csproj">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\OldApplication\Driver.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\OldApplication\Operation.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\OldVersion\OldVersion.csproj">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Examples\TestProjects\OldVersion\Program.qs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Compile Include="Tests.fs" />
<Compile Include="ProjectTests.fs" />
</ItemGroup>

<ItemGroup />

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="xunit" Version="2.4.1" />
Expand Down
1 change: 0 additions & 1 deletion src/QsFmt/App.Tests/Example1.qs

This file was deleted.

1 change: 0 additions & 1 deletion src/QsFmt/App.Tests/Example2.qs

This file was deleted.

1 change: 1 addition & 0 deletions src/QsFmt/App.Tests/Examples/SyntaxError.qs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace Foo { invalid syntax; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;

namespace OldApplication
{
class Driver
{
static void Main(string[] args)
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Quantum.Standard" Version="0.6.1905.301" />
<PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.6.1905.301" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace OldApplication {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;

operation Operation () : Unit {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.2103133969">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
11 changes: 11 additions & 0 deletions src/QsFmt/App.Tests/Examples/TestProjects/OldVersion/Program.qs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Quantum.QSharpApplication1 {

open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;


@EntryPoint()
operation HelloQ () : Unit {
Message("Hello quantum world!");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Quantum.ReferenceLibrary {

open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;


operation LibraryOperation () : Unit {
Message("Hello from the Reference Library!");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.18.2109162713">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Excluded1() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Included1() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Quantum.QSharpApplication1 {

open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Chemistry;
open Microsoft.Quantum.Intrinsic;
open Quantum.ReferenceLibrary;


@EntryPoint()
operation HelloQ () : Unit {
Message("Hello quantum world!");
LibraryOperation();
let x = HTerm([], []);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.18.2109162713">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<QSharpCompile Remove="Excluded1.qs" />
<QSharpCompile Remove="SubFolder1\Excluded2.qs" />
<QSharpCompile Remove="SubFolder1\SubSubFolder\Excluded4.qs" />
<QSharpCompile Remove="SubFolder2\Excluded3.qs" />
<QSharpCompile Include="..\..\Example1.qs">
<Link>Example1.qs</Link>
</QSharpCompile>
<QSharpCompile Include="..\..\Example2.qs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ReferenceLibrary\ReferenceLibrary.csproj" />
<PackageReference Include="Microsoft.Quantum.Chemistry" Version ="0.18.2109162713" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Excluded2() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Included2() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Excluded4() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Included4() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Excluded3() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Included3() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Excluded1() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Included1() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Quantum.QSharpLibrary1 {

open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Chemistry;
open Microsoft.Quantum.Intrinsic;
open Quantum.ReferenceLibrary;


operation HelloQ () : Unit {
Message("Hello quantum world!");
LibraryOperation();
let x = HTerm([], []);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.18.2109162713">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<QSharpCompile Remove="Excluded1.qs" />
<QSharpCompile Remove="SubFolder1\Excluded2.qs" />
<QSharpCompile Remove="SubFolder1\SubSubFolder\Excluded4.qs" />
<QSharpCompile Remove="SubFolder2\Excluded3.qs" />
<QSharpCompile Include="..\..\Example1.qs">
<Link>Example1.qs</Link>
</QSharpCompile>
<QSharpCompile Include="..\..\Example2.qs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ReferenceLibrary\ReferenceLibrary.csproj" />
<PackageReference Include="Microsoft.Quantum.Chemistry" Version ="0.18.2109162713" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Excluded2() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Included2() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Excluded4() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Included4() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Excluded3() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Included3() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Excluded1() : Int { for (i in 0..1) {} return 0; } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace TestTarget { function Included1() : Int { for (i in 0..1) {} return 0; } }
Loading