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-2284] Cannot invoke 'XCTAssertEqual' with an argument list of type '([Array<Int>], [[Int]])' #381

Closed
masters3d opened this issue Aug 5, 2016 · 8 comments

Comments

@masters3d
Copy link

Previous ID SR-2284
Radar None
Original Reporter @masters3d
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

swift-DEVELOPMENT-SNAPSHOT-2016-08-04-a-osx

Additional Detail from JIRA
Votes 0
Component/s XCTest
Labels Bug
Assignee None
Priority Medium

md5: dffa2b0d994403b9420f7549454b2423

is duplicated by:

  • SR-5494 can't compare multidimensional arrays for equality in Swift 4

relates to:

  • SR-894 Foundation is able to compare multidimensional arrays in OS X but not in Linux
  • SR-1535 No == overload exists for comparing optional arrays.

Issue Description:

Cannot invoke 'XCTAssertEqual' with an argument list of type '([Array<Int>], [[Int]])'

import Cocoa
import XCTest

struct Row{
    static var rows:[[Int]] {
        return [[1]]
    }
}

class RowTests: XCTestCase {
    
    func testOneRow() {
        
        XCTAssertEqual([[1]], Row.rows)
}
}
@CodaFi
Copy link
Member

CodaFi commented Aug 5, 2016

XCTAssertEqual is only specialized one level deep on arrays. That means that until we have conditional conformances this will not work without an overload.

@masters3d
Copy link
Author

It was working fine on xcode8beta2 and before that. Was this a new change to XCTest? How did it work before?

@belkadan
Copy link

belkadan commented Aug 5, 2016

Before it was converting to NSArray, as in SR-894. That may or may not be the behavior you want, but I think it's reasonable to have to specify that explicitly (using as NSArray).

cc @jckarter

@masters3d
Copy link
Author

Oh. I guess the confusing part for me is that it is telling me that
[Array<Int>] != [[Int]]
Are they really different?

@belkadan
Copy link

belkadan commented Aug 5, 2016

It's not saying that; it's that the entire argument list isn't valid. If you open up the triangle it should give you more information about why, although you might have to look in the build log for the full story. (There's definitely a usability problem here.)

@masters3d
Copy link
Author

ah I see, well the error is the same when the types don't match.
```
Cannot invoke 'XCTAssertEqual' with an argument list of type '([Int], [String])'
```

I am going to flat map before giving it to XCTest for now as a work around.

@Dante-Broggi
Copy link

Has this been fixed? If so it should be closed.

@CodaFi
Copy link
Member

CodaFi commented Jul 17, 2018

Resolved by the merge of this

@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

4 participants