Skip to content

Commit

Permalink
update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
brettfo committed Jun 29, 2024
1 parent e7909a5 commit f1a9c62
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 21 deletions.
18 changes: 9 additions & 9 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project>
<ItemGroup>
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.3" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.3" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.6" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.6" />
<PackageVersion Include="Microsoft.DotNet.Interactive" Version="1.0.0-beta.24229.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
<PackageVersion Include="StreamJsonRpc" Version="2.12.27" />
<PackageVersion Include="System.Reactive" Version="5.0.0" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="StreamJsonRpc" Version="2.18.48" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
<PackageVersion Include="xunit" Version="2.8.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions src/IxMilia.Lisp.DebugAdapter/DebugAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ private async Task LaunchAsync(LaunchRequest launch)
_host.RootFrame.ErrorOccurred += RootFrame_ErrorOccurred;
_host.RootFrame.EvaluatingExpression += RootFrame_EvaluatingExpression;
_host.RootFrame.FunctionEntered += RootFrame_FunctionEntered;
#pragma warning disable VSTHRD003 // Avoid awaiting foreign Tasks
await _configurationDone.Task;
#pragma warning restore VSTHRD003 // Avoid awaiting foreign Tasks
_executionState.InsertCodeOperations(launch.Arguments.Program, fileContent);
PushMessage(new LaunchResponse(GetNextSeq(), launch.Seq));
await ContinueEvaluationAsync();
Expand Down
18 changes: 9 additions & 9 deletions src/IxMilia.Lisp.Test/InvocationArgumentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void BindOptionalArguments()
new LispInteger(14)),
LispSymbol.CreateFromString("SHOULD-BE-NIL")
);
Assert.Equal(1, argumentCollection.RegularArguments.Count);
Assert.Single(argumentCollection.RegularArguments);
Assert.Equal(2, argumentCollection.OptionalArguments.Count);
Assert.Empty(argumentCollection.KeywordArguments);
Assert.Empty(argumentCollection.AuxiliaryArguments);
Expand All @@ -87,7 +87,7 @@ public void BindKeywordArguments()
new LispInteger(14)),
LispSymbol.CreateFromString("SHOULD-BE-NIL")
);
Assert.Equal(1, argumentCollection.RegularArguments.Count);
Assert.Single(argumentCollection.RegularArguments);
Assert.Empty(argumentCollection.OptionalArguments);
Assert.Equal(2, argumentCollection.KeywordArguments.Count);
Assert.Empty(argumentCollection.AuxiliaryArguments);
Expand All @@ -110,7 +110,7 @@ public void BindAuxiliaryArguments()
new LispInteger(2)),
LispSymbol.CreateFromString("NNIILL")
);
Assert.Equal(1, argumentCollection.RegularArguments.Count);
Assert.Single(argumentCollection.RegularArguments);
Assert.Empty(argumentCollection.OptionalArguments);
Assert.Empty(argumentCollection.KeywordArguments);
Assert.Equal(2, argumentCollection.AuxiliaryArguments.Count);
Expand All @@ -132,7 +132,7 @@ public void BindRestArgument()
new LispLambdaListKeyword("&REST"),
LispSymbol.CreateFromString("THE-REST")
);
Assert.Equal(1, argumentCollection.RegularArguments.Count);
Assert.Single(argumentCollection.RegularArguments);
Assert.Empty(argumentCollection.OptionalArguments);
Assert.Empty(argumentCollection.KeywordArguments);
Assert.NotNull(argumentCollection.RestArgument);
Expand All @@ -154,9 +154,9 @@ public void BindOptionalAndKeywordAndRestArguments()
new LispLambdaListKeyword("&REST"),
LispSymbol.CreateFromString("THE-REST")
);
Assert.Equal(1, argumentCollection.RegularArguments.Count);
Assert.Equal(1, argumentCollection.OptionalArguments.Count);
Assert.Equal(1, argumentCollection.KeywordArguments.Count);
Assert.Single(argumentCollection.RegularArguments);
Assert.Single(argumentCollection.OptionalArguments);
Assert.Single(argumentCollection.KeywordArguments);
Assert.NotNull(argumentCollection.RestArgument);

Assert.Equal("A", argumentCollection.RegularArguments[0].Name);
Expand Down Expand Up @@ -453,8 +453,8 @@ public void MatchKeywordAndOptionalAndRestArgumentsWithValues()

Assert.Equal("THE-REST", matched[3].Item1.Name);
var rest = ((LispList)matched[3].Item2).ToList();
Assert.Equal(1, rest.Count);
Assert.Equal(4, ((LispInteger)rest[0]).Value);
var remainder = Assert.Single(rest);
Assert.Equal(4, ((LispInteger)remainder).Value);
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions src/IxMilia.Lisp.Test/ObjectReadTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ public async Task ReadTableCopying()
public async Task BackQuoteReadAndEval(string code, string expected, string alternateExpected = null)
{
var (host, readResult) = await ReadHostAndResultAsync(code);
var evalResult = host.EvalAsync(readResult, host.CreateExecutionState());
var actual = evalResult.Result.Value.ToDisplayString(host.CurrentPackage);
var evalResult = await host.EvalAsync(readResult, host.CreateExecutionState());
var actual = evalResult.Value.ToDisplayString(host.CurrentPackage);
Assert.True(expected == actual || alternateExpected == actual, $"Expected: {expected} or {alternateExpected}, Actual: {actual}");
}

Expand Down
2 changes: 1 addition & 1 deletion src/IxMilia.Lisp.Test/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected static void EnsureNotError(LispObject obj)
{
if (obj is LispError error)
{
Assert.True(false, $"{error.Message} at {error.SourceLocation}");
Assert.Fail($"{error.Message} at {error.SourceLocation}");
}
}

Expand Down
25 changes: 25 additions & 0 deletions src/IxMilia.Lisp/LispObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,31 @@ public LispFloat AsFloat()
throw new InvalidOperationException("Not possible, must be a simple number");
}
}

public abstract override bool Equals(object obj);
public abstract override int GetHashCode();

public static bool operator ==(LispSimpleNumber a, LispSimpleNumber b)
{
switch (a)
{
case null:
return b is null;
case LispInteger i:
return i.Equals(b);
case LispFloat f:
return f.Equals(b);
case LispRatio r:
return r.Equals(b);
default:
throw new Exception("Expected a simple number");
}
}

public static bool operator !=(LispSimpleNumber a, LispSimpleNumber b)
{
return !(a == b);
}
}

public class LispInteger : LispSimpleNumber
Expand Down

0 comments on commit f1a9c62

Please sign in to comment.