Updated for 0.5.1 release

This commit is contained in:
Nick Lockwood
2016-08-26 00:06:49 +01:00
parent 76c5c197e0
commit 107e56880e
10 changed files with 22 additions and 17 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
// SwiftFormat
// main.swift
//
// Version 0.5
// Version 0.5.1
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Charcoal Design
@@ -33,7 +33,7 @@
import Foundation
let version = "0.5"
let version = "0.5.1"
func processInput(inputURL: NSURL, andWriteToOutput outputURL: NSURL, withOptions options: FormattingOptions) -> Int {
let manager = NSFileManager.defaultManager()
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
SwiftFormat
Version 0.5, August 25th, 2016
Version 0.5.1, August 25th, 2016
Copyright (c) 2016 Nick Lockwood
+5
View File
@@ -322,6 +322,11 @@ With a syntax tree in place, it should become possible to add much more sophisti
Release notes
----------------
Version 0.5.1
- Fixed critical bug where double unwrap (e.g. `foo??.bar()`) was not handled correctly
- Fixed bug where `case let .SomeEnum` was not handled correctly
Version 0.5
- swiftformat command-line tool now supports reading from stdin/writing to stdout
+3 -3
View File
@@ -2,7 +2,7 @@
// SwiftFormat
// Formatter.swift
//
// Version 0.5
// Version 0.5.1
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Charcoal Design
@@ -416,7 +416,7 @@ public func spaceAroundOperators(formatter: Formatter) {
return false
}
}
func isUnwrapOperatorSequence(token: Token) -> Bool {
for c in token.string.characters {
if c != "?" && c != "!" {
@@ -502,7 +502,7 @@ public func spaceAroundOperators(formatter: Formatter) {
(previousNonWhitespaceToken.type != .Operator ||
(previousNonWhitespaceToken.string == "?" && scopeStack.last?.string != "?") ||
(previousNonWhitespaceToken.string != "?" &&
isUnwrapOperatorSequence(previousNonWhitespaceToken))) &&
isUnwrapOperatorSequence(previousNonWhitespaceToken))) &&
(previousNonWhitespaceToken.type != .Identifier ||
!spaceAfter(previousNonWhitespaceToken.string)) {
if previousTokenWasWhitespace {
+1 -1
View File
@@ -2,7 +2,7 @@
// SwiftFormat
// SwiftFormat.h
//
// Version 0.5
// Version 0.5.1
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Charcoal Design
+1 -1
View File
@@ -2,7 +2,7 @@
// SwiftFormat
// SwiftFormat.swift
//
// Version 0.5
// Version 0.5.1
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Charcoal Design
+1 -1
View File
@@ -2,7 +2,7 @@
// SwiftFormat
// Tokenizer.swift
//
// Version 0.5
// Version 0.5.1
//
// Created by Nick Lockwood on 11/08/2016.
// Copyright 2016 Charcoal Design
+4 -4
View File
@@ -2,7 +2,7 @@
// SwiftFormat
// FormatterTests.swift
//
// Version 0.5
// Version 0.5.1
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Charcoal Design
@@ -383,7 +383,7 @@ class FormatterTests: XCTestCase {
let output = "foo?.bar"
XCTAssertEqual(format(input, rules: [spaceAroundOperators]), output)
}
func testNoSpaceAroundMultipleOptionalChaining() {
let input = "foo??!?!.bar"
let output = "foo??!?!.bar"
@@ -401,7 +401,7 @@ class FormatterTests: XCTestCase {
let output = "foo?.bar"
XCTAssertEqual(format(input, rules: [spaceAroundOperators]), output)
}
func testNoSpaceBetweenMultipleOptionalChaining() {
let input = "foo??! .bar"
let output = "foo??!.bar"
@@ -419,7 +419,7 @@ class FormatterTests: XCTestCase {
let output = "foo?\n .bar"
XCTAssertEqual(format(input, rules: [spaceAroundOperators]), output)
}
func testSplitLineMultipleOptionalChaining() {
let input = "foo??!\n .bar"
let output = "foo??!\n .bar"
+4 -4
View File
@@ -2,7 +2,7 @@
// SwiftFormat
// TokenizerTests.swift
//
// Version 0.5
// Version 0.5.1
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Charcoal Design
@@ -466,18 +466,18 @@ class TokenizerTests: XCTestCase {
]
XCTAssertEqualArrays(tokenize(input), output)
}
func testOperatorMayContainDotIfStartsWithDot() {
let input = ".*.."
let output = [Token(.Operator, ".*..")]
XCTAssertEqualArrays(tokenize(input), output)
}
func testOperatorMayNotContainDotUnlessStartsWithDot() {
let input = "*.."
let output = [
Token(.Operator, "*"),
Token(.Operator, "..")
Token(.Operator, ".."),
]
XCTAssertEqualArrays(tokenize(input), output)
}