OpenSwiftUIProject / OpenSwiftUI

[WIP] Open source implementation of Apple's SwiftUI.
https://swiftpackageindex.com/OpenSwiftUIProject/OpenSwiftUI/main/documentation/openswiftui
MIT License
912 stars 27 forks source link

Fix GraphHost/setTime(_ time:) guard should be not equal. #74

Closed Dark-Existed closed 4 months ago

Kyle-Ye commented 4 months ago

Could you please also add a GraphHostTests.swift file under Tests/OpenSwiftUITests and add a test case for setTime?

//
//  GraphHostTests.swift
//  OpenSwiftUITests

@testable import OpenSwiftUI
import Testing

struct GraphHostTests {
    @Test
    func setTimeTest() {
        ...
    }
}
Dark-Existed commented 4 months ago

Done.

Dark-Existed commented 4 months ago

On Ubuntu when access graphHost.data.time will crash. It looks like @ Attribute cause this? PTAL.

Thread 0 "OpenSwiftUIPack":
0  0x00007f9955382cce <unknown> in libc.so.6
Thread 1 crashed:
0 [system]         0x0000564cb14aece4 GraphHost.Data.time.getter + 36 in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/Sources/OpenSwiftUI/Core/Graph/GraphHost.swift
  1 [ra] [inlined]   0x0000564cb159b053 freestanding macro expansion #1 of expect in GraphHostTests.setTimeTest() in OpenSwiftUIPackageTests.xctest at /tmp/swift-generated-sources/@__swiftmacro_16OpenSwiftUITests14GraphHostTestsV11setTimeTestyyF6expectfMf_.swift:1:52
  2 [ra]             0x0000564cb159b053 GraphHostTests.setTimeTest() + 146 in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/Tests/OpenSwiftUITests/Core/Graph/GraphHostTests.swift:12:9
  3 [ra]             0x0000564cb159baa6 closure #2 in static GraphHostTests.$s16OpenSwiftUITests14GraphHostTestsV11setTimeTest0I0fMp_17funcsetTimeTest__fMu1_@Sendable () + 53 in OpenSwiftUIPackageTests.xctest at /tmp/swift-generated-sources/@__swiftmacro_16OpenSwiftUITests14GraphHostTestsV11setTimeTest0I0fMp_.swift:13:102
  4 [async]          0x0000564cb16fbca0 __ifMainActorIsolationEnforced<A>(_:else:) in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/.build-test-debug/checkouts/swift-testing/Sources/Testing/Test+Macro.swift:493
  5 [async]          0x0000564cb159ab70 static GraphHostTests.$s16OpenSwiftUITests14GraphHostTestsV11setTimeTest0I0fMp_17funcsetTimeTest__fMu1_@Sendable () in OpenSwiftUIPackageTests.xctest at /tmp/swift-generated-sources/@__swiftmacro_16OpenSwiftUITests14GraphHostTestsV11setTimeTest0I0fMp_.swift:8
  6 [async]          0x0000564cb159be40 implicit closure #1 in static GraphHostTests.$s16OpenSwiftUITests14GraphHostTestsV11setTimeTest0I0fMp_47__🟠$test_container__function__funcsetTimeTest__fMu_.__tests.getter in OpenSwiftUIPackageTests.xctest at /tmp/swift-generated-sources/@__swiftmacro_16OpenSwiftUITests14GraphHostTestsV11setTimeTest0I0fMp_.swift:28
  7 [async]          0x0000564cb16da500 closure #1 in closure #1 in closure #1 in closure #1 in Runner._runTestCase(_:within:) in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/.build-test-debug/checkouts/swift-testing/Sources/Testing/Running/Runner.swift:328
  8 [async] [thunk]  0x0000564cb16e1e50 partial apply for closure #1 in closure #1 in closure #1 in closure #1 in Runner._runTestCase(_:within:) in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/<compiler-generated>
  9 [async]          0x0000564cb16cf030 Runner._executeTraits(for:testCase:_:) in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/.build-test-debug/checkouts/swift-testing/Sources/Testing/Running/Runner.swift:130
 10 [async]          0x0000564cb16da250 closure #1 in closure #1 in closure #1 in Runner._runTestCase(_:within:) in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/.build-test-debug/checkouts/swift-testing/Sources/Testing/Running/Runner.swift:327
 11 [async] [thunk]  0x0000564cb16e1b80 partial apply for closure #1 in closure #1 in closure #1 in Runner._runTestCase(_:within:) in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/<compiler-generated>
 12 [async]          0x0000564cb171fe40 withTimeLimit(for:configuration:_:timeoutHandler:) in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/.build-test-debug/checkouts/swift-testing/Sources/Testing/Traits/TimeLimitTrait.swift:195
 13 [async]          0x0000564cb16d9e40 closure #1 in closure #1 in Runner._runTestCase(_:within:) in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/.build-test-debug/checkouts/swift-testing/Sources/Testing/Running/Runner.swift:326
 14 [async] [thunk]  0x0000564cb16e1880 partial apply for closure #1 in closure #1 in Runner._runTestCase(_:within:) in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/<compiler-generated>
 15 [async]          0x0000564cb16cdc90 Runner._withErrorHandling(sourceLocation:_:) in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/.build-test-debug/checkouts/swift-testing/Sources/Testing/Running/Runner.swift:87
 16 [async]          0x0000564cb16d9740 closure #1 in Runner._runTestCase(_:within:
) in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/.build-test-debug/checkouts/swift-testing/Sources/Testing/Running/Runner.swift:325
 17 [async] [thunk]  0x0000564cb16e1780 partial apply for closure #1 in Runner._runTestCase(_:within:) in OpenSwiftUIPackageTests.xctest at /__w/OpenSwiftUI/OpenSwiftUI/<compiler-generated>
 18 [async]          0x00007f9956377d00 TaskLocal.withValueImpl<A>(_:operation:file:line:) in libswift_Concurrency.so
 ...
Dark-Existed commented 4 months ago

OK, I see, it hasn`t implemented OGGraphGetValue for OpenGraph.

Kyle-Ye commented 4 months ago

Thanks. Sorry for the delayed reply.