From 7f901d9d495e74b15c0bbd712b5c957b9eaea828 Mon Sep 17 00:00:00 2001 From: Cassandra Granade Date: Fri, 18 Mar 2022 16:07:38 -0700 Subject: [PATCH] Add regression test for #606. --- src/Tests/IQsharpEngineTests.cs | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/Tests/IQsharpEngineTests.cs b/src/Tests/IQsharpEngineTests.cs index 132d1db672..f101c5d52b 100644 --- a/src/Tests/IQsharpEngineTests.cs +++ b/src/Tests/IQsharpEngineTests.cs @@ -951,6 +951,43 @@ operation RunTeleport() : Unit { "compiled as an entry point for job execution." ) )); + + + + } + + + /// + /// Tests for regression against + /// + /// microsoft/iqsharp#606 + /// . + /// + [TestMethod] + public async Task CompileAndSimulateWithLambdas() + { + const string source = @" + function Foo() : Unit { + let f = x -> x; + let y = f(12); + } + + operation DoBar() : Unit { + let u = (q) => H(q); + use q = Qubit(); + H(q); + u(q); + } + "; + + var engineInput = await Assert.That + .UsingEngine() + .Input(source) + .ExecutesSuccessfully() + .Input("%simulate Foo") + .ExecutesSuccessfully() + .Input("%simulate DoBar") + .ExecutesSuccessfully(); } } }