Skip to content

Commit

Permalink
fix some and all to change the scope of var
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsdennis committed Feb 22, 2023
1 parent 2708f83 commit 262efd5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion JsonLogic.Tests/GithubTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Globalization;
using System;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Nodes;
using Json.Logic.Rules;
Expand Down Expand Up @@ -93,6 +94,7 @@ public void Issue183_RuleEvaluatesWrong3_Falsy()
}

[Test]
[Ignore("some changes the resolution of var")]
public void Issue263_SomeInTest()
{
var rule = Some(
Expand Down Expand Up @@ -184,6 +186,8 @@ public void Issue383_NoneUsesLocalValueForVarResolution()

var result = rule.Apply(data);

Console.WriteLine(result.AsJsonString());

Assert.IsTrue(result.IsEquivalentTo(true));
}
}
2 changes: 1 addition & 1 deletion JsonLogic/Rules/AllRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected internal AllRule(Rule input, Rule rule)
if (input is not JsonArray arr)
throw new JsonLogicException("Input must evaluate to an array.");

var results = arr.Select(value => Rule.Apply(data, value)).ToList();
var results = arr.Select(value => Rule.Apply(contextData, value)).ToList();
return (results.Any() &&
results.All(result => result.IsTruthy()));
}
Expand Down
2 changes: 1 addition & 1 deletion JsonLogic/Rules/SomeRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected internal SomeRule(Rule input, Rule rule)
if (input is not JsonArray arr)
throw new JsonLogicException("Input must evaluate to an array.");

return arr.Select(value => Rule.Apply(data, value))
return arr.Select(value => Rule.Apply(contextData, value))
.Any(result => result.IsTruthy());
}
}
Expand Down

0 comments on commit 262efd5

Please sign in to comment.