Skip to content

Commit 9dc97f3

Browse files
committed
integrated akkadotnet#164 and akkadotnet#163 together for testing purposes
1 parent a53c56f commit 9dc97f3

File tree

2 files changed

+3
-40
lines changed

2 files changed

+3
-40
lines changed

src/HOCON.Tests/Extensions/IsStringTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public class IsStringTests
2929
[Fact]
3030
public void IsString_should_detect_String_literals()
3131
{
32-
TestHocon.GetObject("root").IsString().Should().BeFalse();
33-
TestHocon.GetObject("root.foo").IsString().Should().BeFalse();
32+
TestHocon.GetObject("root").Type.Should().NotBe(HoconType.String);
33+
TestHocon.GetObject("root.foo").Type.Should().NotBe(HoconType.String);
3434
var values = TestHocon.GetObject("root.foo");
35-
values["bar"].IsString().Should().BeTrue();
35+
values["bar"].Type.Should().Be(HoconType.String);
3636
}
3737
}
3838
}

src/Hocon/Extensions/HoconElementExtensions.cs

-37
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,6 @@ public static IHoconElement CloneValue(this IHoconElement hoconElement, IHoconEl
1818
return hoconElement is HoconSubstitution ? hoconElement : hoconElement.Clone(newParent);
1919
}
2020

21-
/// <summary>
22-
/// Checks to see if this <see cref="IHoconElement"/> is a literal and if it is,
23-
/// if it's a supported string type.
24-
/// </summary>
25-
/// <param name="literal">The HOCON element to check.</param>
26-
public static bool IsString(this HoconObject literal)
27-
{
28-
if (literal.Values.Count == 1 && literal.All(x => x.Value.Type == HoconType.Literal))
29-
{
30-
var literalType = HoconLiteralType.QuotedString;
31-
switch (literalType)
32-
{
33-
case HoconLiteralType.QuotedString:
34-
case HoconLiteralType.UnquotedString:
35-
case HoconLiteralType.TripleQuotedString:
36-
case HoconLiteralType.Whitespace:
37-
return true;
38-
case HoconLiteralType.Null:
39-
break;
40-
case HoconLiteralType.Bool:
41-
break;
42-
case HoconLiteralType.Long:
43-
break;
44-
case HoconLiteralType.Hex:
45-
break;
46-
case HoconLiteralType.Octal:
47-
break;
48-
case HoconLiteralType.Double:
49-
break;
50-
}
51-
}
52-
53-
54-
55-
return false;
56-
}
57-
5821
public static bool IsLiteral(this HoconType hoconType)
5922
{
6023
switch (hoconType)

0 commit comments

Comments
 (0)