Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions MFSJSONEntity/include/MFSJSONEntity.h
1 change: 1 addition & 0 deletions MFSJSONEntity/include/MFSJSONEntityElementProtocol.h
1 change: 1 addition & 0 deletions MFSJSONEntity/include/MFSJSONEntityPropertyProtocol.h
1 change: 1 addition & 0 deletions MFSJSONEntity/include/NSObject+JSONEntity.h
1 change: 1 addition & 0 deletions MFSJSONEntity/include/NSObject+MFSJSONEntity.h
30 changes: 30 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// swift-tools-version:5.2
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "MFSJSONEntity",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "MFSJSONEntity",
targets: ["MFSJSONEntity"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "MFSJSONEntity",
dependencies: [],
path:"MFSJSONEntity"
),
.testTarget(
name: "MFSJSONEntityTests",
dependencies: ["MFSJSONEntity"]),
]
)
7 changes: 7 additions & 0 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import XCTest

import MFSJSONEntityTests

var tests = [XCTestCaseEntry]()
tests += MFSJSONEntityTests.allTests()
XCTMain(tests)
34 changes: 34 additions & 0 deletions Tests/MFSJSONEntityTests/MFSJSONEntityTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import XCTest
@testable import MFSJSONEntity

final class MFSJSONEntityTests: XCTestCase {
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
print("Hello, MFS JSONEntity! ")
let person = Person()
person.name = "max"
person.age = 99
let personDict = person.propertyDictionary()
print(personDict!)

let JSONString = "{\"name\":\"max\",\"age\":98}"
if let JSONData = JSONString.data(using: .utf8), let dictionary = try? JSONSerialization.jsonObject(with: JSONData, options: .fragmentsAllowed) as? [String:Any], let obj = Person.object(with: dictionary) as? Person {
print("person:\(obj), name:\(obj.name), age:\(obj.age)")
}
let propertys = Person.propertyNames()
print("Person propertys:\(propertys)")
}

static var allTests = [
("testExample", testExample),
]
}

@objc class Person: NSObject {
var name:String?
var age:Int?
var other:String? {nil}

}
9 changes: 9 additions & 0 deletions Tests/MFSJSONEntityTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import XCTest

#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(MFSJSONEntityTests.allTests),
]
}
#endif