Skip to content

Commit

Permalink
Merge pull request #13 from idomizrachi/template-engine-support
Browse files Browse the repository at this point in the history
Template engine support
  • Loading branch information
idomizrachi authored Jul 27, 2019
2 parents a057bfb + 37c5407 commit 10fb519
Show file tree
Hide file tree
Showing 71 changed files with 5,553 additions and 767 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.idea/vcs.xml
.idea/workspace.xml
.idea/xcode.xml
regen.xcodeproj/project.xcworkspace/xcuserdata/idomizrachi.xcuserdatad
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
os: osx
osx_image: xcode10.2
language: swift
script:
- xcodebuild -scheme regen clean build test
after_success:
- bash <(curl -s https://codecov.io/bash) -J 'regen'
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,5 @@ To:

`Localization.loginButton`


## Credits\Thanks
https://github.com/icodeforlove/Colors for the ANSI color library
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage:
ignore:
- "regen/Dependencies/**/*"
- "regen-tests/**/*"
79 changes: 79 additions & 0 deletions regen-tests/ArgumentsParserTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//
// ArgumentsParserTests.swift
// regen-tests
//
// Created by Ido Mizrachi on 12/07/2019.
// Copyright © 2019 Ido Mizrachi. All rights reserved.
//

import XCTest

class ArgumentsParserTests: XCTestCase {

func testEmptyArguments() {
let argumentsParser = ArgumentsParser(arguments: [])
switch argumentsParser.operationType {
case .usage: break
default: XCTFail("Bad operation")
}
}
}

class ArgumentsParserLocalizationTests: XCTestCase {

func testLocalizationOperationDefaultArguments() {
let argumentsParser = ArgumentsParser(arguments: ["localization"])
switch argumentsParser.operationType {
case .usage: break
default: XCTFail("Bad operation")
}

}

func testLocalizationOperationWithMissingSearchPath() {
let argumentsParser = ArgumentsParser(arguments: ["localization", "--template", "hello", "--output", "Gen.m"])
switch argumentsParser.operationType {
case .usage: break
default: XCTFail("Bad operation")
}
}

// func testLocalizationOperationWithMissingOutput() {
// let argumentsParser = ArgumentsParser(arguments: ["localization", "--search-path", "hello", "--template", "hello"])
// switch argumentsParser.operationType {
// case .usage: break
// default: XCTFail("Bad operation")
// }
// }

func testLocalizationOperationWithMissingTemplate() {
let argumentsParser = ArgumentsParser(arguments: ["localization", "--output", "hello", "--search-path", "hello"])
switch argumentsParser.operationType {
case .usage: break
default: XCTFail("Bad operation")
}
}

func testImagesOperationWithDefaultArguments() {
let argumentsParser = ArgumentsParser(arguments: ["images"])
switch argumentsParser.operationType {
case .usage: break
default: XCTFail("Bad operation")
}
}


// func testLocalizationOperationWithValidParameters() {
// let argumentsParser = ArgumentsParser(arguments: ["localization", "--template", "hello", "--output", "Gen.swift", "--search-path", "Search Path", "--base-language-code", "he"])
// switch argumentsParser.operationType {
// case .localization(let parameters):
// XCTAssertEqual(parameters.templateFilepath, "hello")
// XCTAssertEqual(parameters.outputFilename, "Gen.swift")
// XCTAssertEqual(parameters.searchPath, "Search Path")
// XCTAssertEqual(parameters.baseLanguageCode, "he")
// default: XCTFail("Bad operation")
// }
// }
}


22 changes: 22 additions & 0 deletions regen-tests/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
28 changes: 28 additions & 0 deletions regen-tests/StringClassNameTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// StringClassNameTests.swift
// regen-tests
//
// Created by Ido Mizrachi on 24/07/2019.
// Copyright © 2019 Ido Mizrachi. All rights reserved.
//

import XCTest

class StringClassNameTests: XCTestCase {

func testConvertToClassName() {
let text = "helloThere"
XCTAssertEqual(text.className(), "HelloThere")
}

func testEmptyString() {
let text = ""
XCTAssertEqual(text.className(), "")
}

func testAlreadyCapitalizedString() {
let text = "HOLYSheep"
XCTAssertEqual(text.className(), "HOLYSheep")
}

}
15 changes: 15 additions & 0 deletions regen-tests/regen_tests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// regen_tests.swift
// regen-tests
//
// Created by Ido Mizrachi on 12/07/2019.
// Copyright © 2019 Ido Mizrachi. All rights reserved.
//

import XCTest


class regen_tests: XCTestCase {


}
Loading

0 comments on commit 10fb519

Please sign in to comment.