Skip to content

Instantly share code, notes, and snippets.

@anzfactory
Created April 30, 2021 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anzfactory/c33b45917debb4c3d5635d2356ac132c to your computer and use it in GitHub Desktop.
Save anzfactory/c33b45917debb4c3d5635d2356ac132c to your computer and use it in GitHub Desktop.
テストケースを自動生成させるためのテンプレート
//
// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen
//
{% macro allValuesBlock assets prefix %}
{% for asset in assets %}
{% if asset.items %}
{% set newPrefix %}{{prefix}}{{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}.{% endset %}
{% call allValuesBlock asset.items newPrefix %}
{% elif asset.type != "group" %}
_ = Asset.{{prefix}}{{asset.name|swiftIdentifier:"pretty"|lowerFirstWord}}.{{asset.type}}
{% endif %}
{% endfor %}
{% endmacro %}
import XCTest
@testable import YoutProjectName
class AssetTests: XCTestCase {
func testAssetsAreAvailable() throws {
{% for catalog in catalogs %}
{% call allValuesBlock catalog.assets "" %}
{% endfor %}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment