-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #55 - test * #55 - исправление бага * #55 - доработка вычисления отрезка для выражения вызова * #55 - доработка теста
- Loading branch information
Showing
8 changed files
with
57 additions
and
10 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/Application/HydraScript.Application.StaticAnalysis/Exceptions/CannotAssignVoid.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,6 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace HydraScript.Application.StaticAnalysis.Exceptions; | ||
|
||
[ExcludeFromCodeCoverage] | ||
public class CannotAssignVoid(string segment) : SemanticException(segment, "Cannot assign void"); |
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
1 change: 0 additions & 1 deletion
1
tests/HydraScript.IntegrationTests/ErrorPrograms/VariableInitializationTests.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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
using System.CommandLine.Parsing; | ||
using FluentAssertions; | ||
|
||
namespace HydraScript.IntegrationTests.ErrorPrograms; | ||
|
||
|
26 changes: 26 additions & 0 deletions
26
tests/HydraScript.IntegrationTests/ErrorPrograms/VoidAssignmentTests.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,26 @@ | ||
using System.CommandLine.Parsing; | ||
|
||
namespace HydraScript.IntegrationTests.ErrorPrograms; | ||
|
||
public class VoidAssignmentTests(TestHostFixture fixture) : IClassFixture<TestHostFixture> | ||
{ | ||
[Fact] | ||
public void FunctionDeclared_VoidReturnAssigned_ExitCodeHydraScriptError() | ||
{ | ||
const string script = | ||
""" | ||
function func(b: boolean) { | ||
if (b) | ||
return | ||
return | ||
} | ||
let x = func(true) | ||
"""; | ||
var runner = fixture.GetRunner(configureTestServices: | ||
services => services.SetupInMemoryScript(script)); | ||
var code = runner.Invoke(fixture.InMemoryScript); | ||
code.Should().Be(ExitCodes.HydraScriptError); | ||
fixture.LogMessages.Should() | ||
.Contain(x => x.Contains("Cannot assign void")); | ||
} | ||
} |
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,3 +1,4 @@ | ||
// Global using directives | ||
|
||
global using Xunit; | ||
global using Xunit; | ||
global using FluentAssertions; |
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,5 +1,4 @@ | ||
using System.CommandLine.Parsing; | ||
using FluentAssertions; | ||
|
||
namespace HydraScript.IntegrationTests; | ||
|
||
|