text stringlengths 9 39.2M | dir stringlengths 26 295 | lang stringclasses 185
values | created_date timestamp[us] | updated_date timestamp[us] | repo_name stringlengths 1 97 | repo_full_name stringlengths 7 106 | star int64 1k 183k | len_tokens int64 1 13.8M |
|---|---|---|---|---|---|---|---|---|
```swift
import Foundation
import XCTest
import Cuckoo
final class MultiLayeredNestedTestedSubclassTest: XCTestCase {
private var mock: Multi.Layered.Nested.MockMultiLayeredNestedTestedSubclass!
override func setUp() {
super.setUp()
mock = Multi.Layered.Nested.MockMultiLayeredNestedTestedSub... | /content/code_sandbox/Tests/Swift/MultiLayeredNestedTestedSubclassTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 1,534 |
```swift
import XCTest
import Cuckoo
final class CallMatcherFunctionsTest: XCTestCase {
private let tests: [(message: String, matcher: CallMatcher, argument: Int, expected: Bool)] = [
("times(2) - true", times(2), 2, true),
("times(2) - false", times(2), 3, false),
("never - true", never(),... | /content/code_sandbox/Tests/Swift/Matching/CallMatcherFunctionsTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 358 |
```swift
import XCTest
import Cuckoo
final class ParameterMatcherTest: XCTestCase {
func testMatches() {
let matcher = ParameterMatcher { $0 == 5 }
XCTAssertTrue(matcher.matches(5))
XCTAssertFalse(matcher.matches(4))
}
func testOr() {
let matcher = ParameterMat... | /content/code_sandbox/Tests/Swift/Matching/ParameterMatcherTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 229 |
```swift
import XCTest
import Cuckoo
final class MatchableTest: XCTestCase {
func testOr() {
let matcher = 5.or(4)
XCTAssertTrue(matcher.matches(5))
XCTAssertTrue(matcher.matches(4))
XCTAssertFalse(matcher.matches(3))
}
func testAnd() {
let matcher = 5.and(... | /content/code_sandbox/Tests/Swift/Matching/MatchableTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 288 |
```swift
import XCTest
import Cuckoo
final class ParameterMatcherFunctionsTest: XCTestCase {
func testEqualToEquatable() {
XCTAssertTrue(equal(to: 1).matches(1))
XCTAssertFalse(equal(to: 1).matches(2))
}
func testEqualToAnyObject() {
let x = X()
XCTAssertTrue(equal(to: x).... | /content/code_sandbox/Tests/Swift/Matching/ParameterMatcherFunctionsTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 1,977 |
```swift
import XCTest
import Cuckoo
final class DictionaryParameterMatcherTest: XCTestCase {
// MARK: Contains ANY of the elements as key-value pairs.
func testContainsAnyOf() {
// With keys identical to values.
XCTAssertFalse(containsAnyOf([1, 3].toDictionaryAsKeysWithHashable()).matches([2].... | /content/code_sandbox/Tests/Swift/Matching/Dictionary+matchersTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 5,306 |
```swift
import XCTest
import Cuckoo
final class CallMatcherTest: XCTestCase {
private let call = [ConcreteStubCall(method: "A", parameters: Void()) as StubCall]
private var multipleCalls: [StubCall] {
return [call[0], call[0]]
}
func testMatches() {
let matcher = CallMatcher(name: "")... | /content/code_sandbox/Tests/Swift/Matching/CallMatcherTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 223 |
```swift
import XCTest
import Cuckoo
final class VerificationTest: XCTestCase {
func testVerify() {
let mock = MockTestedClass()
stub(mock) { mock in
when(mock.noReturn()).thenDoNothing()
}
mock.noReturn()
verify(mock).noReturn()
}
func... | /content/code_sandbox/Tests/Swift/Verification/VerificationTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 292 |
```swift
import XCTest
import Cuckoo
final class ArgumentCaptorTest: XCTestCase {
func testMultipleCalls() {
let mock = MockTestedClass()
stub(mock) { mock in
when(mock.readWriteProperty.set(anyInt())).thenDoNothing()
}
mock.readWriteProperty = 10
mock.readWriteP... | /content/code_sandbox/Tests/Swift/Verification/ArgumentCaptorTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 200 |
```swift
class TestedSubclass: TestedClass, TestedProtocol {
required override init() {
super.init()
}
required init(test: String) {
super.init()
}
required init(labelA a: String, _ b: String) {
super.init()
}
init(notRequired: Bool) {
super.init()
}
... | /content/code_sandbox/Tests/Swift/Source/TestedSubclass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 685 |
```swift
import XCTest
import Cuckoo
struct TestStructs {
struct N {
let g: Int
}
struct E: Equatable {
let g: Int
}
struct H: Hashable {
let g: Int
}
}
final class ArrayMatcherTest: XCTestCase {
// MARK: Contains ANY of the elements.
func testContainsAnyOf() {
... | /content/code_sandbox/Tests/Swift/Matching/Array+matchersTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 4,516 |
```swift
import Foundation
@available(swift 4.0)
class Nested {
class NestedTestedSubclass: TestedClass { }
private class ThisClassShouldNotBeMocked3 {
var property: Int?
}
class NestedTestedClass {
let constant: Float = 0.0
private(set) var privateSetProperty: Int =... | /content/code_sandbox/Tests/Swift/Source/NestedInNestedClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 617 |
```swift
import Foundation
class MultiNestedClass {
private class PrivateNestedClass {
class ThisClassShouldNotBeMocked2 {
var property: Int?
}
}
}
``` | /content/code_sandbox/Tests/Swift/Source/MultiNestedInPrivateNestedClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 38 |
```swift
import Foundation
// there was a bug with "where" clauses incorrectly matching, this class is used to test it
class wViewyContwollew {}
class GenericMethodClass<ClassyT: CustomStringConvertible> {
func senpai<OwO>(param: OwO) throws -> OwO where OwO: CustomStringConvertible {
return param
}
... | /content/code_sandbox/Tests/Swift/Source/GenericMethodClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 323 |
```swift
class ClassForStubTesting {
var intProperty: Int = 0
var arrayProperty: [Int] = []
var setProperty: Set<Int> = []
var dictionaryProperty: [String: Int] = [:]
var tuple1: (Int) = (1)
var tuple2: (Int8, UInt8) = (1, 1)
var tuple3: (Int16, UInt16, Bool) = (1, 1, true)
var t... | /content/code_sandbox/Tests/Swift/Source/ClassForStubTesting.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 285 |
```swift
import Foundation
fileprivate extension Multi.Nested {
class ThisClassShouldNotBeMocked1 {
var property: Int?
}
}
``` | /content/code_sandbox/Tests/Swift/Source/MultiNestedPrivateExtensionClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 31 |
```swift
import Foundation
extension Nested {
@available(swift 4.0)
class NestedExtensionTestedClass {
let constant: Float = 0.0
private(set) var privateSetProperty: Int = 0
var readOnlyProperty: String {
return "a"
}
var readOnlyOptionalProperty: String?... | /content/code_sandbox/Tests/Swift/Source/NestedInExtensionFromClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 585 |
```swift
class ExcludedTestClass {
func shouldNotBeAvailable() {
}
}
class IncludedTestClass {
func shouldExist() {
}
}
protocol IncludedProtocol {}
protocol ExcludedProtocol {}
``` | /content/code_sandbox/Tests/Swift/Source/ExcludedTestClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 39 |
```swift
import Foundation
struct NestedStruct {
class NestedTestedSubclass: TestedClass { }
}
extension NestedStruct {
class NestedExtensionTestedClass: TestedClass { }
}
``` | /content/code_sandbox/Tests/Swift/Source/NestedInNestedStruct.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 38 |
```swift
class ClassWithOptionals {
var value: Int? = 0
var uValue: Int! = 0
var array: [Int?] = []
var closure: (Int?) -> Void = { _ in }
func returnValue() -> Int? {
return value
}
func returnUValue() -> Int! {
return uValue
}
func returnArray() -> [Int?] {
... | /content/code_sandbox/Tests/Swift/Source/ClassWithOptionals.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 120 |
```swift
import Foundation
fileprivate class PrivateNestedClass {
class ThisClassShouldNotBeMocked2 {
var property: Int?
}
}
``` | /content/code_sandbox/Tests/Swift/Source/NestedInPrivateNestedClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 31 |
```swift
protocol TestedProtocol {
var readOnlyProperty: String { get }
var readWriteProperty: Int { get set }
var optionalProperty: Int? { get set }
var closureProperty: ((String) -> Int) -> () { get set }
var closureWithArgumentNameProperty: (_ i: (_ j: String) -> Int) -> () { get set }
... | /content/code_sandbox/Tests/Swift/Source/TestedProtocol.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 1,013 |
```swift
protocol TestedSubProtocol: TestedProtocol {
func noReturnSub()
}
``` | /content/code_sandbox/Tests/Swift/Source/TestedSubProtocol.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 16 |
```swift
import Foundation
@available(tvOS, unavailable)
protocol UnavailablePlatformProtocol {
var availableProperty: Bool { get }
}
``` | /content/code_sandbox/Tests/Swift/Source/UnavailablePlatformProtocol.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 27 |
```swift
import Foundation
fileprivate extension Nested {
class ThisClassShouldNotBeMocked1 {
var property: Int?
}
}
``` | /content/code_sandbox/Tests/Swift/Source/NestedPrivateExtensionClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 29 |
```swift
#warning("TODO: Create a new library and move this file to the library to ensure the use case is the same as our users'")
import class Foundation.NSArray ;import Foundation
@available(iOS 42.0, *)
protocol UnavailableProtocol { }
@available(swift 4.0)
class TestedClass {
typealias NormalTypealias = Int
... | /content/code_sandbox/Tests/Swift/Source/TestedClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 3,938 |
```swift
//
protocol UnicodeTest {
///
func doSomething(str: String) -> String
func () -> String
}
//
// +
//
protocol UnicodeNameTest_ {
func doSomething(: String)
}
``` | /content/code_sandbox/Tests/Swift/Source/UnicodeTestProtocol.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 48 |
```swift
import Foundation
extension Multi.Nested {
@available(swift 4.0)
class NestedExtensionTestedClass : TestedClass {}
}
``` | /content/code_sandbox/Tests/Swift/Source/MultiNestedInExtensionFromClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 31 |
```swift
import SwiftUI
protocol SwiftUIViewModelProtocol: ObservableObject {}
class SwiftUIViewModel: ObservableObject {}
``` | /content/code_sandbox/Tests/Swift/Source/SwiftUIProtocols.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 19 |
```swift
import Foundation
protocol PlainProtocolToTestNSObjectProtocolInheritance {
}
protocol ProtocolNotInheritingFromNSObjectProtocol {
}
protocol ProtocolInheritingFromNSObjectProtocol: NSObjectProtocol {
}
protocol ChildProtocolInheritingFromNSObjectProtocol: ProtocolInheritingFromNSObjectProtocol {
}
protoc... | /content/code_sandbox/Tests/Swift/Source/NSObjectProtocolInheritanceTesting.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 152 |
```swift
import Foundation
@available(tvOS, unavailable)
class UnavailablePlatformClass {
var property = 0
}
``` | /content/code_sandbox/Tests/Swift/Source/UnavailablePlatformClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 25 |
```swift
import Foundation
@available(swift 4.0)
class Multi {
class Nested {
class MultiNestedTestedSubclass: TestedClass { }
private class ThisClassShouldNotBeMocked3 {
var property: Int?
}
}
class Layered {
class Nested {
class MultiL... | /content/code_sandbox/Tests/Swift/Source/MultiNestedInNestedClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 118 |
```swift
import Foundation
class ClassWithUnavailablePlatformMembers {
@available(tvOS, unavailable)
var unavailableProperty: Int { 0 }
@available(tvOS, unavailable)
@available(macCatalyst, unavailable)
var multiUnavailableProperty: Int { 1 }
var availableProperty: Bool = false
@availabl... | /content/code_sandbox/Tests/Swift/Source/ClassWithUnavailablePlatformMembers.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 200 |
```swift
import Foundation
@objc
protocol ObjcProtocol {
@objc
optional func optionalMethod()
}
@objc
class ObjcClass: NSObject {
@objc
func objcMethod() {}
}
@objcMembers
class ObjcMembersClass {
func objcMethod() {}
}
``` | /content/code_sandbox/Tests/Swift/Source/ObjcProtocol.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 61 |
```swift
//
// PropertyWrappers.swift
// Cuckoo
//
// Created by Kabir Oberai on 2023-03-28.
//
// wrappers without annotations aren't supported but their
// existence shouldn't cause the generator to crash
@propertyWrapper
struct DoublingWrapper {
private var backing: Int
var wrappedValue: Int {
g... | /content/code_sandbox/Tests/Swift/Source/PropertyWrappers.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 179 |
```swift
import Foundation
protocol GenericProtocol {
associatedtype C: AnyObject
associatedtype V
var readOnlyPropertyC: C { get }
var readWritePropertyV: V { get set }
var constant: Int { get }
var optionalProperty: V? { get set }
init(theC: C, theV: V)
func callSomeC(theC: C) -> ... | /content/code_sandbox/Tests/Swift/Source/GenericProtocol.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 239 |
```swift
import Foundation
class GenericClass<T: CustomStringConvertible, U: Codable & CustomStringConvertible, V: Hashable & Equatable> {
let constant = 10.0
var readWritePropertyT: T
var readWritePropertyU: U
var readWritePropertyV: V
var optionalProperty: U?
init(theT: T, theU: U, theV: V... | /content/code_sandbox/Tests/Swift/Source/GenericClass.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 428 |
```swift
import XCTest
@testable import Cuckoo
final class StubNoReturnThrowingFunctionTest: XCTestCase {
func testThen() {
let mock = MockTestedClass()
var called = false
stub(mock) { mock in
when(mock.withNoReturnThrows()).then {
called = true
}
... | /content/code_sandbox/Tests/Swift/Stubbing/StubNoReturnThrowingFunctionTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 286 |
```swift
import XCTest
@testable import Cuckoo
final class StubNoReturnFunctionTest: XCTestCase {
func testThen() {
let mock = MockTestedClass()
var called = false
stub(mock) { mock in
when(mock.noReturn()).then {
called = true
}
}
mo... | /content/code_sandbox/Tests/Swift/Stubbing/StubNoReturnFunctionTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 175 |
```swift
import XCTest
@testable import Cuckoo
final class StubFunctionTest: XCTestCase {
func testThen() {
let mock = MockTestedClass()
stub(mock) { mock in
when(mock.count(characters: "a")).then {
return $0.count * 2
}
}
XCTAssertEqual(mock... | /content/code_sandbox/Tests/Swift/Stubbing/StubFunctionTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 201 |
```swift
import XCTest
@testable import Cuckoo
final class StubThrowingFunctionTest: XCTestCase {
func testThen() {
let mock = MockTestedClass()
stub(mock) { mock in
when(mock.withThrows()).then {
return 2
}
}
XCTAssertEqual(try! mock.withThr... | /content/code_sandbox/Tests/Swift/Stubbing/StubThrowingFunctionTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 360 |
```swift
import XCTest
enum TestError: Error {
case unknown
static func errorCheck(file: StaticString = #file, line: UInt = #line) -> (Error) -> Void {
return {
if $0 is TestError {
} else {
XCTFail("Expected TestError, got: \(type(of: $0))(\($0.localizedDescrip... | /content/code_sandbox/Tests/Common/TestError.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 94 |
```swift
import XCTest
import Cuckoo
#if os(iOS)
import WebKit
final class ObjectiveProtocolTest: XCTestCase {
func testThenDoNothing() {
let mock = objcStub(for: UIScrollViewDelegate.self) { stubber, mock in
stubber.when(mock.scrollViewDidScrollToTop!(objcAny())).thenDoNothing()
}
... | /content/code_sandbox/Tests/OCMock/ObjectiveProtocolTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 1,082 |
```swift
import XCTest
@testable import Cuckoo
final class StubbingTest: XCTestCase {
func testMultipleReturns() {
let mock = MockTestedClass()
stub(mock) { mock in
when(mock.readOnlyProperty.get).thenReturn("a").thenReturn("b", "c")
}
XCTAssertEqual(mock.readOnlyProper... | /content/code_sandbox/Tests/Swift/Stubbing/StubbingTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 3,693 |
```swift
import OCMock
import Cuckoo
import XCTest
#if os(iOS)
final class ObjectiveClassTest: XCTestCase {
func testThenDoNothing() {
let mock = objcStub(for: UIView.self) { stubber, mock in
stubber.when(mock.addSubview(objcAny())).thenDoNothing()
}
mock.addSubview(UIView())
... | /content/code_sandbox/Tests/OCMock/ObjectiveClassTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 1,813 |
```swift
import XCTest
final class OrderedSetTest: XCTestCase {
func testInitializers() {
_ = OrderedSet<Int>()
_ = [] as OrderedSet<String>
_ = ["1", "2", "4"] as OrderedSet<String>
}
func testEmpty() {
let set = OrderedSet<Double>()
XCTAssertEqual(set.values, [])
... | /content/code_sandbox/Generator/Tests/OrderedSetTest.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 672 |
```swift
import ProjectDescription
import ProjectDescriptionHelpers
let target = Target(
name: "Cuckoonator",
platform: .macOS,
product: .commandLineTool,
productName: "cuckoonator",
bundleId: "Cuckoonator",
deploymentTarget: .macOS(targetVersion: "12.0"),
sources: "Sources/**",
depende... | /content/code_sandbox/Generator/Project.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 731 |
```swift
import Foundation
import PackagePlugin
@main
struct CuckooPluginFile: BuildToolPlugin {
func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] {
let sources: [FileList.Element] = target.dependencies
.flatMap { dependency in
switch dep... | /content/code_sandbox/Generator/Plugin/File/CuckooPluginFile.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 616 |
```swift
import Foundation
import PackagePlugin
// FIXME: Xcode complains that prebuild commands can't use executable targets a prebuild command cannot use executables built from source, including executable target 'CuckooGenerator'
// FIXME: So I'll leave the code here, but unfortunately it's not usable in the curre... | /content/code_sandbox/Generator/Plugin/Directory/CuckooPluginDirectory.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 457 |
```swift
import Foundation
@dynamicMemberLookup
final class Reference<Value> {
private(set) var value: Value
init(_ value: Value) {
self.value = value
}
subscript<T>(dynamicMember keyPath: KeyPath<Value, T>) -> T {
value[keyPath: keyPath]
}
subscript<T>(dynamicMem... | /content/code_sandbox/Generator/Sources/Internal/Reference.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 155 |
```swift
import Foundation
import Stencil
@globalActor
actor StaticActor {
static let shared = StaticActor()
}
struct GeneratorHelper {
@StaticActor
private static let extensions = createExtensions()
@StaticActor
static func generate(tokens: [Token], debug: Bool = false) throws -> String {
... | /content/code_sandbox/Generator/Sources/Internal/GeneratorHelper.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 1,845 |
```swift
import Foundation
struct TypeGuesser {
static func guessType(from value: String) -> String? {
guard !value.trimmed.isEmpty else { return nil }
let value = value.trimmed
guard !value.isEmpty else { return nil }
let casting = checkCasting(from: value)
guard casting =... | /content/code_sandbox/Generator/Sources/Internal/TypeGuesser.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 408 |
```swift
import Foundation
struct OrderedSet<Element: Hashable>: ExpressibleByArrayLiteral {
var values: [Element] {
orderedSet.array as! [Element]
}
private let orderedSet: NSMutableOrderedSet
init() {
orderedSet = NSMutableOrderedSet()
}
init(arrayLiteral elements: Element.... | /content/code_sandbox/Generator/Sources/Internal/OrderedSet.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 317 |
```swift
import Foundation
import FileKit
struct FileHeaderHandler {
static func header(for file: FileRepresentation, timestamp: String?) -> String {
let path = getRelativePath(to: file)
return [
"// MARK: - Mocks generated from file: '\(path)'",
timestamp.map { "at \($0)" }... | /content/code_sandbox/Generator/Sources/Internal/FileHeaderHandler.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 308 |
```swift
import SwiftSyntax
extension Optional where Wrapped == DeclModifierListSyntax {
var isFinal: Bool {
self?.isFinal ?? false
}
var isStatic: Bool {
self?.isStatic ?? false
}
}
extension DeclModifierListSyntax {
var isFinal: Bool {
contains { $0.name.tokenKind == .ke... | /content/code_sandbox/Generator/Sources/Internal/Crawlers/ModifierListSyntax+common.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 105 |
```swift
import Foundation
import SwiftSyntax
import SwiftParser
final class Crawler: SyntaxVisitor {
static func crawl(url: URL) throws -> Crawler {
let file = try String(contentsOf: url)
let syntaxTree = Parser.parse(source: file)
#if DEBUG
// Comment out the line above and uncomm... | /content/code_sandbox/Generator/Sources/Internal/Crawlers/Crawler.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 4,302 |
```swift
import SwiftSyntax
extension Optional where Wrapped == TokenSyntax {
var isPresent: Bool {
self?.isPresent ?? false
}
}
extension TokenSyntax {
var isPresent: Bool {
presence == .present
}
}
``` | /content/code_sandbox/Generator/Sources/Internal/Crawlers/SyntaxToken+isPresent.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 51 |
```swift
import FileKit
extension Path {
func relative(to path: Path) -> Path {
relative(to: path.rawValue)
}
func relative(to path: String) -> Path {
if isAbsolute {
return self
} else {
return path + self
}
}
func relative(to path: String?... | /content/code_sandbox/Generator/Sources/Internal/Helpers/FileKit+convenience.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 109 |
```swift
import Foundation
extension Array where Element: Hashable {
func uniquing() -> [Element] {
OrderedSet(self).values
}
}
``` | /content/code_sandbox/Generator/Sources/Internal/Helpers/Array+uniquing.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 32 |
```swift
import Foundation
// Taken from path_to_url
extension Sequence {
func asyncMap<T>(
_ transform: (Element) async throws -> T
) async rethrows -> [T] {
var values = [T]()
for element in self {
try await values.append(transform(element))
}
return val... | /content/code_sandbox/Generator/Sources/Internal/Helpers/Async+convenience.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 484 |
```swift
import Foundation
extension String {
var nilIfEmpty: String? {
isEmpty ? nil : self
}
}
extension String {
subscript(range: NSRange) -> String {
let fromIndex = self.index(self.startIndex, offsetBy: range.location)
let toIndex = self.index(fromIndex, offsetBy: range.length... | /content/code_sandbox/Generator/Sources/Internal/Helpers/String+convenience.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 256 |
```swift
import Foundation
extension String {
var trimmed: String {
return trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
}
func takeUntil(occurence: String) -> String? {
return components(separatedBy: occurence).first
}
subscript(range: Range<Int>) -> String {
... | /content/code_sandbox/Generator/Sources/Internal/Helpers/Utils.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 232 |
```swift
import SwiftSyntax
extension StringLiteralExprSyntax {
init(text: String) {
self.init(openingQuote: .stringQuoteToken(), segments: [.stringSegment(.init(content: .stringSegment(text)))], closingQuote: .stringQuoteToken())
}
}
extension ExprSyntaxProtocol {
func tryIf(_ condition: Bool) ->... | /content/code_sandbox/Generator/Sources/Internal/Helpers/SwiftSyntax+convenience.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 165 |
```swift
import Foundation
extension Templates {
static let staticGenericParameter = "_CUCKOO$$GENERIC"
static let typeErasureClassName = "DefaultImplCaller"
static let typeErasureGenericParameterPrefix = "\(staticGenericParameter)_"
static let mock = """
{% for container in containers %}
{% if debug %... | /content/code_sandbox/Generator/Sources/Internal/Templates/MockTemplate.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 1,498 |
```swift
import Foundation
extension Templates {
static let stubbingProxy = """
{{ container.accessibility|withSpace }}struct __StubbingProxy_{{ container.name }}: Cuckoo.StubbingProxy {
private let cuckoo_manager: Cuckoo.MockManager
{{ container.accessibility|withSpace }}init(manager: Cuckoo.MockManager)... | /content/code_sandbox/Generator/Sources/Internal/Templates/StubbingProxyTemplate.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 402 |
```swift
import Foundation
extension Templates {
static let verificationProxy = """
{{ container.accessibility|withSpace }}struct __VerificationProxy_{{ container.name }}: Cuckoo.VerificationProxy {
private let cuckoo_manager: Cuckoo.MockManager
private let callMatcher: Cuckoo.CallMatcher
private let s... | /content/code_sandbox/Generator/Sources/Internal/Templates/VerificationProxyTemplate.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 431 |
```swift
//{{ start }}
// {{ content }}
//{{ end }}
``` | /content/code_sandbox/Generator/Sources/Internal/Templates/ContainerTemplate.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 12 |
```swift
import Foundation
extension Templates {
static let typeErasure = """
{{ container.accessibility|withSpace }}class \(typeErasureClassName): {{ container.name }} {
private let reference: Any
{% for property in container.properties %}
private let _getter_storage$${{ property.name... | /content/code_sandbox/Generator/Sources/Internal/Templates/TypeErasureTemplate.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 590 |
```swift
extension Templates {
static let noImplStub = """
{% for attribute in container.attributes %}
{{ attribute }}
{% endfor %}
{{container.accessibility|withSpace}}class {{ container.name }}Stub{{ container.genericParameters }}: {% if container.isNSObjectProtocol %}NSObject, {% endif %}{{ container.name }}{% i... | /content/code_sandbox/Generator/Sources/Internal/Templates/NopImplStubTemplate.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 413 |
```swift
import Foundation
struct Templates { }
extension String {
func indented(times: Int = 1) -> String {
let indentation = String(repeating: " ", count: times)
return self.components(separatedBy: CharacterSet.newlines).map {
indentation + $0
}.joined(separator: "\n")
... | /content/code_sandbox/Generator/Sources/Internal/Templates/Templates.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 72 |
```swift
import SwiftSyntax
import SwiftParser
enum ComplexType {
indirect case attributed(attributes: [String], baseType: ComplexType)
indirect case optional(wrappedType: ComplexType, isImplicit: Bool)
indirect case array(elementType: ComplexType)
indirect case dictionary(keyType: ComplexType, valueTy... | /content/code_sandbox/Generator/Sources/Internal/Tokens/ComplexType.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 1,931 |
```swift
struct ClassDeclaration: ContainerToken {
var parent: Reference<Token>?
var attributes: [Attribute]
var accessibility: Accessibility
var name: String
var genericParameters: [GenericParameter]
var genericRequirements: [String]
var inheritedTypes: [String]
var members: [Token]
... | /content/code_sandbox/Generator/Sources/Internal/Tokens/ClassDeclaration.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 135 |
```swift
enum ThrowType: String, CustomStringConvertible, Equatable {
case `throws`
case `rethrows`
init?(string: String) {
if string.trimmed.hasPrefix(ThrowType.throws.rawValue) {
self = .throws
} else if string.trimmed.hasPrefix(ThrowType.rethrows.rawValue) {
self ... | /content/code_sandbox/Generator/Sources/Internal/Tokens/ThrowType.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 137 |
```swift
protocol Serializable {
func serialize() -> GeneratorContext
}
typealias GeneratorContext = [String: Any]
extension GeneratorContext {
mutating func merge(_ other: GeneratorContext) {
merge(other, uniquingKeysWith: { $1 })
}
}
extension Array where Element == GeneratorContext {
func ... | /content/code_sandbox/Generator/Sources/Internal/Tokens/Serializable.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 95 |
```swift
import Foundation
struct Method: Token, HasAttributes, HasAccessibility, HasName {
var parent: Reference<Token>?
var documentation: [String]
var attributes: [Attribute]
var accessibility: Accessibility
var name: String
var signature: Signature
var isOptional: Bool
var fullSig... | /content/code_sandbox/Generator/Sources/Internal/Tokens/Method.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 977 |
```swift
struct Deinitializer: Token, HasAttributes {
var parent: Reference<Token>?
var attributes: [Attribute]
}
``` | /content/code_sandbox/Generator/Sources/Internal/Tokens/Deinitializer.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 26 |
```swift
enum AsyncType: String, CustomStringConvertible, Equatable {
case `async`
case `reasync`
var isAsync: Bool {
self == .async
}
var isReasync: Bool {
self == .reasync
}
var description: String {
rawValue
}
}
``` | /content/code_sandbox/Generator/Sources/Internal/Tokens/AsyncType.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 70 |
```swift
import SwiftSyntax
enum Accessibility: String, Equatable {
case `open`
case `public`
case `internal`
case `private`
case `fileprivate`
var sourceName: String {
switch self {
case .open:
fallthrough
case .public:
return "public"
c... | /content/code_sandbox/Generator/Sources/Internal/Tokens/Accessibility.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 336 |
```swift
struct ProtocolDeclaration: ContainerToken {
var parent: Reference<Token>?
var attributes: [Attribute]
var accessibility: Accessibility
var name: String
var genericParameters: [GenericParameter]
var genericRequirements: [String]
var inheritedTypes: [String]
var members: [Token]... | /content/code_sandbox/Generator/Sources/Internal/Tokens/ProtocolDeclaration.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 228 |
```swift
struct Variable: Token, HasAccessibility, HasAttributes {
struct Effects {
var isThrowing = false
var isAsync = false
}
var parent: Reference<Token>?
var documentation: [String]
var attributes: [Attribute]
var accessibility: Accessibility
var setterAccessibility: A... | /content/code_sandbox/Generator/Sources/Internal/Tokens/Variable.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 472 |
```swift
protocol Token: Serializable {
var parent: Reference<Token>? { get set }
}
extension Token {
func serialize() -> GeneratorContext {
commonSerialize()
}
func commonSerialize() -> GeneratorContext {
[
[
"@type": "\(type(of: self))",
"i... | /content/code_sandbox/Generator/Sources/Internal/Tokens/Token.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 580 |
```swift
struct Initializer: Token, HasAttributes, HasAccessibility {
var parent: Reference<Token>?
var documentation: [String]
var attributes: [Attribute]
var accessibility: Accessibility
var signature: Method.Signature
var isRequired: Bool
var isOptional: Bool
}
extension Initializer: In... | /content/code_sandbox/Generator/Sources/Internal/Tokens/Initializer.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 202 |
```swift
enum Import: Hashable, CustomStringConvertible {
case library(name: String)
case component(kind: String, name: String)
var description: String {
switch self {
case .library(let name):
return name
case .component(let kind, let name):
return "\(kind) \... | /content/code_sandbox/Generator/Sources/Internal/Tokens/Import.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 73 |
```swift
import Foundation
protocol Inheritable {
// Support to dynamically define whether the token is inheritable or not.
var isInheritable: Bool { get }
func isEqual(to other: Inheritable) -> Bool
}
extension Inheritable {
var isInheritable: Bool { true }
}
``` | /content/code_sandbox/Generator/Sources/Internal/Tokens/Inheritable.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 64 |
```swift
enum WrappableType {
indirect case optional(WrappableType)
indirect case implicitlyUnwrappedOptional(WrappableType)
indirect case attributed(WrappableType, attributes: [String])
case type(String)
var sugarized: String {
switch self {
case .optional(let wrapped):
... | /content/code_sandbox/Generator/Sources/Internal/Tokens/WrappableType.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 1,144 |
```swift
protocol ContainerToken: Token, HasAttributes, HasAccessibility, HasName, HasGenerics, HasMembers, HasInheritance {}
extension ContainerToken {
func containerSerialize() -> GeneratorContext {
func withAdjustedAccessibility<TokenType: HasAccessibility>(token: TokenType) -> TokenType {
/... | /content/code_sandbox/Generator/Sources/Internal/Tokens/ContainerToken.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 349 |
```swift
struct MethodParameter: Token {
var parent: Reference<Token>?
var name: String
// FIXME: Is this needed?
var innerName: String?
var type: ComplexType
var isInout: Bool {
type.containsAttribute(named: "inout")
}
var nameAndInnerName: String {
[name, innerNa... | /content/code_sandbox/Generator/Sources/Internal/Tokens/MethodParameter.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 244 |
```swift
import Foundation
struct GenericParameter: Equatable {
let name: String
let inheritedTypes: [String]
var description: String {
if inheritedTypes.isEmpty {
return name
} else {
return "\(name): \(inheritedTypes.joined(separator: " & "))"
}
}
}
e... | /content/code_sandbox/Generator/Sources/Internal/Tokens/GenericParameter.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 222 |
```swift
import Foundation
/// This structure exists purely for supporting nested classes,
/// it could be any container (like `struct` or `extension`).
struct NamespaceDeclaration: Token, HasAccessibility, HasName, HasMembers {
var parent: Reference<Token>?
var attributes: [Attribute]
var accessibility: ... | /content/code_sandbox/Generator/Sources/Internal/Tokens/NamespaceDeclaration.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 126 |
```swift
import Foundation
enum Attribute: Hashable, CustomStringConvertible {
case available(arguments: [String])
case objc
case objcMembers
var description: String {
switch self {
case .available(let arguments):
"@available(\(arguments.joined(separator: ", ")))"
c... | /content/code_sandbox/Generator/Sources/Internal/Tokens/Attribute.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 140 |
```swift
import SwiftSyntax
import SwiftParser
struct Typealias: Token, CustomStringConvertible {
var parent: Reference<Token>?
let alias: String
let original: String
var description: String {
"typealias \(alias) = \(original)"
}
}
extension Typealias {
init(syntax: TypeAliasDeclSynt... | /content/code_sandbox/Generator/Sources/Internal/Tokens/Typealias.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 127 |
```swift
import Foundation
extension Method {
struct Signature {
let genericParameters: [GenericParameter]
let parameters: [MethodParameter]
let asyncType: AsyncType?
let throwType: ThrowType?
let returnType: ComplexType?
let whereConstraints: [String]
init(... | /content/code_sandbox/Generator/Sources/Internal/Tokens/MethodSignature.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 458 |
```swift
protocol HasAccessibility: Token {
var accessibility: Accessibility { get set }
}
extension HasAccessibility {
var areAllHierarchiesAccessible: Bool {
guard accessibility.isAccessible else { return false }
var parent: Token? = parent?.value
while let p = parent as? HasAccessibi... | /content/code_sandbox/Generator/Sources/Internal/Tokens/Capabilities/HasAccessibility.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 93 |
```swift
protocol HasAttributes: Token {
var attributes: [Attribute] { get }
}
extension HasAttributes {
private var unavailablePlatforms: [String] {
attributes.compactMap { $0.unavailablePlatform }
}
var hasUnavailablePlatforms: Bool {
!unavailablePlatforms.isEmpty
}
var unav... | /content/code_sandbox/Generator/Sources/Internal/Tokens/Capabilities/HasAttributes.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 101 |
```swift
protocol HasGenerics: Token {
var genericParameters: [GenericParameter] { get }
var genericRequirements: [String] { get }
}
``` | /content/code_sandbox/Generator/Sources/Internal/Tokens/Capabilities/HasGenerics.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 32 |
```swift
protocol HasMembers: Token {
var members: [Token] { get set }
func replacing(members: [Token]) -> Self
}
``` | /content/code_sandbox/Generator/Sources/Internal/Tokens/Capabilities/HasMembers.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 31 |
```swift
protocol HasInheritance: Token {
var inheritedTypes: [String] { get }
}
``` | /content/code_sandbox/Generator/Sources/Internal/Tokens/Capabilities/HasInheritance.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 20 |
```swift
protocol HasName: Token {
var name: String { get }
}
extension HasName {
var mockName: String {
"Mock\(name)"
}
var fullyQualifiedName: String {
var names = [name]
var parent: Token? = parent?.value
while let p = parent as? HasName {
names.insert(p.... | /content/code_sandbox/Generator/Sources/Internal/Tokens/Capabilities/HasName.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 104 |
```swift
import Foundation
import FileKit
struct FileRepresentation {
let file: TextFile
let imports: [Import]
let tokens: [Token]
init(file: TextFile, imports: [Import], tokens: [Token]) {
self.file = file
self.imports = imports
self.tokens = tokens
}
func replacing(t... | /content/code_sandbox/Generator/Sources/Internal/Tokens/FileRepresentation.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 781 |
```swift
import Foundation
import FileKit
enum CuckooGeneratorError: Error {
case ioError(FileKitError)
case unknownError(Error)
case stderrUsed
var description: String {
switch self {
case .ioError(let error):
return error.description
case .unknownError(let err... | /content/code_sandbox/Generator/Sources/CLI/CuckooGeneratorError.swift | swift | 2016-01-12T14:30:36 | 2024-08-15T17:36:01 | Cuckoo | Brightify/Cuckoo | 1,657 | 86 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.