Map optional boolean return with .map { $0 != 0 }
This commit is contained in:
parent
2bcaafb3f5
commit
3a033057fb
2 changed files with 10 additions and 1 deletions
|
|
@ -604,3 +604,9 @@ func testRecordInGenerateFiles() throws {
|
|||
#expect(output.contains("canFocus.map { $0 ? 1 : 0 } ?? 0"))
|
||||
#expect(!output.contains(", canFocus)"))
|
||||
}
|
||||
|
||||
@Test("Optional boolean return is mapped with != 0")
|
||||
func testOptionalBooleanReturnMapping() {
|
||||
let result = CodeGenerator.wrapCReturnValue(callExpression: "g_value_get_boolean(&value)", returnType: .optional(.boolean))
|
||||
#expect(result == "g_value_get_boolean(&value).map { $0 != 0 }")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue