Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
added first test for schema creator
Browse files Browse the repository at this point in the history
  • Loading branch information
Casperhr committed Dec 29, 2016
1 parent eef970d commit 1b3fa77
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PackageDescription
let package = Package(
name: "Sugar",
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1)
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1),
.Package(url: "https://github.com/vapor/mysql-provider.git", majorVersion: 1, minor: 1)
]
)
1 change: 1 addition & 0 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import XCTest

XCTMain([
testCase(DateSugarTests.allTests),
testCase(CreatorMySQLTests.allTests),
])
26 changes: 26 additions & 0 deletions Tests/SugarTests/CreatorMySQLTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import XCTest
import Fluent

@testable import Sugar

class CreatorMySQLTests: XCTestCase {

func testString() {
let builder = Schema.Creator("table")
builder.string("string")

let sql = builder.schema.sql
let serializer = GeneralSQLSerializer(sql: sql)

let (statement, values) = serializer.serialize()

XCTAssertEqual(statement, "CREATE TABLE `table` (`string` STRING NOT NULL)")
XCTAssertEqual(values.count, 0)
}

static var allTests : [(String, (CreatorMySQLTests) -> () throws -> Void)] {
return [
("testString", testString),
]
}
}

0 comments on commit 1b3fa77

Please sign in to comment.