Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-4374] XCTest breaks when name of test class and module are same #373

Closed
ankitspd opened this issue Mar 27, 2017 · 2 comments
Closed

Comments

@ankitspd
Copy link
Member

Previous ID SR-4374
Radar rdar://problem/31272389
Original Reporter @aciidb0mb3r
Type Bug
Status Resolved
Resolution Done
Environment

macOS

Additional Detail from JIRA
Votes 0
Component/s Compiler, XCTest
Labels Bug
Assignee @eeckstein
Priority Medium

md5: faec7f397bf8f410093b93b78914ca45

Issue Description:

The swift package init command create a simple package with one library and one test target. The test target has one test case subclass with same name as the test target. In this case, the test target name seems to be mangled when running the test and XCTest's selected test option doesn't work.

$ export TOOLCHAINS=swift
$ xcrun --find swift
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2017-03-26-a.xctoolchain/usr/bin/swift
$ mkdir Hello && cd Hello
$ swift package init
$ swift test
Compile Swift Module 'Hello' (1 sources)
Compile Swift Module 'HelloTests' (1 sources)
Linking ./.build/debug/HelloPackageTests.xctest/Contents/MacOS/HelloPackageTests
Test Suite 'All tests' started at 2017-03-27 18:33:53.841
Test Suite 'HelloPackageTests.xctest' started at 2017-03-27 18:33:53.841
Test Suite '*_TtC10HelloTestsAA*' started at 2017-03-27 18:33:53.841
Test Case '-[*_TtC10HelloTestsAA* testExample]' started.
Test Case '-[*_TtC10HelloTestsAA* testExample]' passed (0.074 seconds).
Test Suite '*_TtC10HelloTestsAA*' passed at 2017-03-27 18:33:53.916.
     Executed 1 test, with 0 failures (0 unexpected) in 0.074 (0.074) seconds
Test Suite 'HelloPackageTests.xctest' passed at 2017-03-27 18:33:53.916.
     Executed 1 test, with 0 failures (0 unexpected) in 0.074 (0.075) seconds
Test Suite 'All tests' passed at 2017-03-27 18:33:53.916.
     Executed 1 test, with 0 failures (0 unexpected) in 0.074 (0.075) seconds

$ swift test -s HelloTests.HelloTests
Test Suite 'Selected tests' started at 2017-03-27 18:34:33.328
Test Suite 'HelloPackageTests.xctest' started at 2017-03-27 18:34:33.328
Test Suite 'HelloPackageTests.xctest' passed at 2017-03-27 18:34:33.328.
     Executed *0 tests*, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'Selected tests' passed at 2017-03-27 18:34:33.328.
     Executed *0 tests*, with 0 failures (0 unexpected) in 0.000 (0.000) seconds

Change the HelloTests class to any other name in HelloTests.swift and everything will start working as expected.

@ankitspd
Copy link
Member Author

@swift-ci create

@eeckstein
Copy link
Member

fixed in 069cd570898494cbc4cacbb71b85108054b83a76

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants