giginet / swift-testing-revolutionary

A tool converts test cases written in XCTest to swift-testing
MIT License
200 stars 2 forks source link

[Bugs?] Duplicate code above class name #11

Open psbss opened 3 months ago

psbss commented 3 months ago

Hi giginet! I found small issue. I would be very grateful if you could resolve this 🙏

Issue detail

When the script is run with a comment a few lines above the class in the test case, there seems to be a problem with duplication.

Method

mint

Sample code

original source code

@testable import FooService
import XCTest

// swiftlint:disable type_body_length

final class FooServiceTestCases: XCTestCase {

after run swiftTestingRevolutionary

// swiftlint:disable type_body_length

@Suite 

// swiftlint:disable type_body_length // here is duplicated 😭 

struct FooServiceTestCases {
giginet commented 2 months ago

Treating leading trivia is too complex. I'll add the test case!