Repository: realm/realm-swift
File: Realm/Tests/Swift/SwiftSchemaTests.swift (Swift)

Code before:
        @objc dynamic var value = 0
    }
}
enum EnumWrappingObjectSubclass {
    class Inner: RequiresObjcName {
        @objc dynamic var value = 0
    }
}

private class PrivateClassWithoutExplicitObjcName: RequiresObjcName {
    @objc dynamic var value = 0
}

class SwiftRLMSchemaTests: RLMMultiProcessTestCase {
    func testWorksAtAll() {
        if isParent {
            XCTAssertEqual(0, runChildAndWait(), "Tests in child process failed")
        }
    }

    func testShouldRaiseObjectWithoutProperties() {
        assertThrowsWithReasonMatching(RLMObjectSchema(forObjectClass: NoProps.self),
                                       "No properties are defined for 'NoProps'. Did you remember to mark them with '@objc' or '@Persisted' in your model?")
    }
    
    func testShouldNotThrowForObjectWithOnlyComputedProps() {
        let config = RLMRealmConfiguration.default()
        config.objectClasses = [OnlyComputedTarget.self, OnlyComputedSource.self]
        config.inMemoryIdentifier = #function
        let r = try! RLMRealm(configuration: config)
        try! r.transaction {
            _ = OnlyComputedTarget.create(in: r, withValue: [])
        }
    }

    func testSchemaInitWithLinkedToObjectUsingInitWithValue() {
        if isParent {
            XCTAssertEqual(0, runChildAndWait(), "Tests in child process failed")
            return
        }

        let config = RLMRealmConfiguration.default()
        config.objectClasses = [IgnoredLinkPropertyObject.self]
        config.inMemoryIdentifier = #function
        let r = try! RLMRealm(configuration: config)
        try! r.transaction {
            _ = IgnoredLinkPropertyObject.create(in: r, withValue: [1])
        }
    }

    func testCreateUnmanagedObjectWithUninitializedSchema() {

Review comment (suggestion):
It would valuable to check if the schema for the OnlyComputedTarget indeed only has computed properties and no properties
```
let schema = OnlyComputedTarget().objectSchema
XCTAssertEqual(schema.computedProperties.count, 1)
XCTAssertEqual(schema.properties.count, 0)
```

Code after:
    class Inner: RequiresObjcName {
        @objc dynamic var value = 0
    }
}
struct StructWrappingObjectSubclass {
    class Inner: RequiresObjcName {
        @objc dynamic var value = 0
    }
}
enum EnumWrappingObjectSubclass {
    class Inner: RequiresObjcName {
        @objc dynamic var value = 0
    }
}

private class PrivateClassWithoutExplicitObjcName: RequiresObjcName {
    @objc dynamic var value = 0
}

class SwiftRLMSchemaTests: RLMMultiProcessTestCase {
    func testWorksAtAll() {
        if isParent {
            XCTAssertEqual(0, runChildAndWait(), "Tests in child process failed")
        }
    }

    func testShouldRaiseObjectWithoutProperties() {
        assertThrowsWithReasonMatching(RLMObjectSchema(forObjectClass: NoProps.self),
                                       "No properties are defined for 'NoProps'. Did you remember to mark them with '@objc' or '@Persisted' in your model?")
    }
    
    func testShouldNotThrowForObjectWithOnlyBacklinksProps() {
        let config = RLMRealmConfiguration.default()
        config.objectClasses = [OnlyComputedTarget.self, OnlyComputedSource.self]
        config.inMemoryIdentifier = #function
        let r = try! RLMRealm(configuration: config)
        try! r.transaction {
            _ = OnlyComputedTarget.create(in: r, withValue: [])
        }

        let schema = OnlyComputedTarget().objectSchema
        XCTAssertEqual(schema.computedProperties.count, 1)
        XCTAssertEqual(schema.properties.count, 0)
    }

    func testShouldThrowForObjectWithOnlyComputedNoBacklinksProps() {
        assertThrowsWithReasonMatching(RLMObjectSchema(forObjectClass: OnlyComputedNoBacklinksProps.self),
                                       "No properties are defined for 'OnlyComputedNoBacklinksProps'. Did you remember to mark them with '@objc' or '@Persisted' in your model?")
    }

    func testSchemaInitWithLinkedToObjectUsingInitWithValue() {