-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #4703 ### Description Enable the language server to use the options `disable-nonlinear-arithmetic` and the Z3 executable path, when they are specified in the project file ### How has this been tested? A XUnit test has been added for `disable-nonlinear-arithmetic` <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
- Loading branch information
1 parent
9113843
commit dcebf75
Showing
6 changed files
with
46 additions
and
2 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
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions
37
Source/DafnyLanguageServer.Test/ProjectFiles/SolverOptionsTest.cs
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,37 @@ | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.Dafny.LanguageServer.IntegrationTest.Util; | ||
using Microsoft.Extensions.Logging; | ||
using Moq; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Microsoft.Dafny.LanguageServer.IntegrationTest.ProjectFiles; | ||
|
||
public class SolverOptionsTest : ClientBasedLanguageServerTest { | ||
|
||
[Fact] | ||
public async Task DisableNonLinearArithmeticIsUsed() { | ||
var projectFileSource = @" | ||
[options] | ||
disable-nonlinear-arithmetic = true".TrimStart(); | ||
|
||
var source = @" | ||
lemma Test(a: real, b: real) | ||
requires b != 0.0 | ||
ensures a / b == 1.0 / b * a | ||
{}".TrimStart(); | ||
|
||
var directory = Path.GetRandomFileName(); | ||
CreateAndOpenTestDocument(projectFileSource, Path.Combine(directory, DafnyProject.FileName)); | ||
var sourceDocument = | ||
CreateAndOpenTestDocument(source, Path.Combine(directory, "DisableNonLinearArithmeticIsUsed.dfy")); | ||
var diagnostics = await GetLastDiagnostics(sourceDocument); | ||
Assert.Single(diagnostics); | ||
Assert.Contains("a postcondition", diagnostics.First().Message); | ||
} | ||
|
||
public SolverOptionsTest(ITestOutputHelper output, LogLevel dafnyLogLevel = LogLevel.Information) : base(output, dafnyLogLevel) { | ||
} | ||
} |
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 @@ | ||
Enable verification options that are configured in a Dafny project file, to be picked up by the Dafny language server |