Skip to content

Commit 193dbdc

Browse files
authored
Adding missing string interpolation handling (Flight-School#73)
1 parent 56901f2 commit 193dbdc

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ DeriveredData/
1010
/*.gcno
1111
**/xcshareddata/WorkspaceSettings.xcsettings
1212
Carthage/Build/
13+
/.swiftpm

Sources/AnyCodable/AnyCodable.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ extension AnyCodable: ExpressibleByBooleanLiteral {}
100100
extension AnyCodable: ExpressibleByIntegerLiteral {}
101101
extension AnyCodable: ExpressibleByFloatLiteral {}
102102
extension AnyCodable: ExpressibleByStringLiteral {}
103+
extension AnyCodable: ExpressibleByStringInterpolation {}
103104
extension AnyCodable: ExpressibleByArrayLiteral {}
104105
extension AnyCodable: ExpressibleByDictionaryLiteral {}
105106

Tests/AnyCodableTests/AnyCodableTests.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ class AnyCodableTests: XCTestCase {
8181
func testJSONEncoding() throws {
8282

8383
let someCodable = AnyCodable(SomeCodable(string: "String", int: 100, bool: true, hasUnderscore: "another string"))
84-
84+
85+
let injectedValue = 1234
8586
let dictionary: [String: AnyCodable] = [
8687
"boolean": true,
8788
"integer": 42,
8889
"double": 3.141592653589793,
8990
"string": "string",
91+
"stringInterpolation": "string \(injectedValue)",
9092
"array": [1, 2, 3],
9193
"nested": [
9294
"a": "alpha",
@@ -108,6 +110,7 @@ class AnyCodableTests: XCTestCase {
108110
"integer": 42,
109111
"double": 3.141592653589793,
110112
"string": "string",
113+
"stringInterpolation": "string 1234",
111114
"array": [1, 2, 3],
112115
"nested": {
113116
"a": "alpha",

0 commit comments

Comments
 (0)