pharo-spec / NewTools

All development tools for Pharo, developed with Spec
21 stars 53 forks source link

Now testSelectedEntriesMultipleSelection fails #803

Closed hernanmd closed 2 weeks ago

hernanmd commented 2 months ago

The problem is that SpMultipleSelectionModeis comparing FileReference's using identity. When using ==, you're checking if two FileReference objects are the same object in memory. For FileReferences, this will often return false, even when referring to the same file, because each time you create a FileReference (even for the same path), a new object is instantiated:

| rootFS file1 |
rootFS := FileSystem memory.
file1 := (rootFS / 'file1.txt') ensureCreateFile.
(rootFS / 'file1.txt') == file1.

To reproduce, step into the following method:

Screenshot 2024-07-18 at 14 40 13

Question: Should SpCollectionListModel>>#indexOf:ifAbsent: use indexOf:ifAbsent: instead of identityIndexOf: anItem ifAbsent: aBlock at least for comparing FileReferences?