mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 04:12:13 +00:00
Merge pull request #254 from jonreid/master
Update Swift Package Manager, clean up starting test, add README
This commit is contained in:
commit
045597940b
@ -1,4 +1,4 @@
|
||||
// swift-tools-version:5.1
|
||||
// swift-tools-version:5.3
|
||||
|
||||
import PackageDescription
|
||||
|
||||
|
||||
12
swift/README.md
Normal file
12
swift/README.md
Normal file
@ -0,0 +1,12 @@
|
||||
## Build and test using any of the following
|
||||
|
||||
Command line:
|
||||
- `swift test`
|
||||
|
||||
Xcode:
|
||||
- Open this "swift" folder to open package
|
||||
- In the Xcode menu, select Product > Test to run tests
|
||||
|
||||
AppCode:
|
||||
- Open this "swift" folder to open package
|
||||
- Select "GildedRoseTests" configuration and run
|
||||
@ -1,12 +1,12 @@
|
||||
public class GildedRose {
|
||||
var items:[Item]
|
||||
var items: [Item]
|
||||
|
||||
public init(items:[Item]) {
|
||||
public init(items: [Item]) {
|
||||
self.items = items
|
||||
}
|
||||
|
||||
public func updateQuality() {
|
||||
for i in 0..<items.count {
|
||||
for i in 0 ..< items.count {
|
||||
if (items[i].name != "Aged Brie" && items[i].name != "Backstage passes to a TAFKAL80ETC concert") {
|
||||
if (items[i].quality > 0) {
|
||||
if (items[i].name != "Sulfuras, Hand of Ragnaros") {
|
||||
|
||||
@ -3,16 +3,14 @@ import XCTest
|
||||
|
||||
class GildedRoseTests: XCTestCase {
|
||||
|
||||
func testFoo() {
|
||||
func testFoo() throws {
|
||||
let items = [Item(name: "foo", sellIn: 0, quality: 0)]
|
||||
let app = GildedRose(items: items);
|
||||
app.updateQuality();
|
||||
XCTAssertEqual("fixme", app.items[0].name);
|
||||
let app = GildedRose(items: items)
|
||||
app.updateQuality()
|
||||
XCTAssertEqual(app.items[0].name, "fixme")
|
||||
}
|
||||
|
||||
static var allTests : [(String, (GildedRoseTests) -> () throws -> Void)] {
|
||||
return [
|
||||
("testFoo", testFoo),
|
||||
]
|
||||
}
|
||||
static var allTests = [
|
||||
("testFoo", testFoo),
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user