File tree Expand file tree Collapse file tree
src/Domain/HydraScript.Domain.BackEnd/Impl/Instructions/WithAssignment
tests/HydraScript.IntegrationTests/SuccessPrograms Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ protected virtual void Assign()
7373 {
7474 "-" => - Convert . ToDouble ( value ) ,
7575 "!" => ! Convert . ToBoolean ( value ) ,
76- "~" when value is List < object > list => list . Count ,
77- "~" when value is string @string => @string . Length ,
76+ "~" when value is List < object > list => Convert . ToDouble ( list . Count ) ,
77+ "~" when value is string @string => Convert . ToDouble ( @string . Length ) ,
7878 "" => value ,
7979 _ => throw new NotSupportedException ( $ "_operator { _operator } is not supported")
8080 } ;
Original file line number Diff line number Diff line change 1+ using HydraScript . Infrastructure ;
2+
3+ namespace HydraScript . IntegrationTests . SuccessPrograms ;
4+
5+ public class ArithmeticTests ( TestHostFixture fixture ) : IClassFixture < TestHostFixture >
6+ {
7+ /// <summary>
8+ /// https://github.com/Stepami/hydrascript/issues/232
9+ /// </summary>
10+ [ Fact ]
11+ public void Equality_AdditionToTheLeft_Success ( )
12+ {
13+ const string script =
14+ """
15+ let i = 0
16+ const s = "abcdef"
17+ const sLen = ~s
18+ while (i < sLen) {
19+ if (i + 1 == sLen)
20+ >>> "i is 5"
21+ i = i + 1
22+ }
23+ """ ;
24+ using var runner = fixture . GetRunner (
25+ new TestHostFixture . Options (
26+ InMemoryScript : script ) ) ;
27+ var code = runner . Invoke ( ) ;
28+ code . Should ( ) . Be ( Executor . ExitCodes . Success ) ;
29+ fixture . LogMessages . Should ( )
30+ . Contain ( log => log . Contains ( "i is 5" ) ) ;
31+ }
32+ }
Original file line number Diff line number Diff line change 33using Microsoft . Extensions . DependencyInjection ;
44using NSubstitute ;
55
6- namespace HydraScript . IntegrationTests ;
6+ namespace HydraScript . IntegrationTests . SuccessPrograms ;
77
88public class DumpOptionTests ( TestHostFixture fixture ) : IClassFixture < TestHostFixture >
99{
Original file line number Diff line number Diff line change 33using Microsoft . Extensions . DependencyInjection . Extensions ;
44using NSubstitute ;
55
6- namespace HydraScript . IntegrationTests ;
6+ namespace HydraScript . IntegrationTests . SuccessPrograms ;
77
88public class InputTests ( TestHostFixture fixture ) : IClassFixture < TestHostFixture >
99{
Original file line number Diff line number Diff line change 11using HydraScript . Infrastructure ;
22
3- namespace HydraScript . IntegrationTests ;
3+ namespace HydraScript . IntegrationTests . SuccessPrograms ;
44
55public class SuccessfulProgramsTests ( TestHostFixture fixture ) : IClassFixture < TestHostFixture >
66{
You can’t perform that action at this time.
0 commit comments