Skip to content

Commit

Permalink
Fix #1305
Browse files Browse the repository at this point in the history
  • Loading branch information
fdodino committed Mar 22, 2018
1 parent 586551d commit c34e5cd
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 12 deletions.
5 changes: 2 additions & 3 deletions org.uqbar.project.wollok.lib/src/wollok/lang.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,8 @@ class Collection {
method flatten() = self.flatMap { e => e }

/** @private */
override method internalToSmartString(alreadyShown) {
return self.toStringPrefix() + self.map{e=> e.toSmartString(alreadyShown) }.join(', ') + self.toStringSufix()
}
override method internalToSmartString(alreadyShown) =
self.toStringPrefix() + self.map{ e => if (alreadyShown.contains(e)) e.toSmartString(alreadyShown) else e.printString() }.join(', ') + self.toStringSufix()

/** @private */
method toStringPrefix()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,25 @@ class ListTestCase extends CollectionTestCase {
assert.throwsExceptionWithMessage("-1.00000 must be a positive integer value", { numbers.get(-1) })
'''.test
}

@Test
def void elementsToString() {
'''
object a {
override method printString() = "es un a"
}
class B {
override method printString() = "cierto que era un b!"
}
program c {
assert.throwsExceptionWithMessage(
"Expected [[es un a]] but found [[cierto que era un b!]]",
{ assert.equals([ a ], [ new B() ]) }
)
}
'''.interpretPropagatingErrors
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,24 @@ class SetTestCase extends CollectionTestCase {
'''.test
}

@Test
def void elementsToString() {
'''
object a {
override method printString() = "es un a"
}
class B {
override method printString() = "cierto que era un b!"
}
program c {
assert.throwsExceptionWithMessage(
"Expected [#{es un a}] but found [#{cierto que era un b!}]",
{ assert.equals(#{a}, #{new B()}) }
)
}
'''.interpretPropagatingErrors
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ListTest extends ListTestCase {
@Test
def void testFirstAndHead() {
'''
const list = [1,2,3]
const list = [1,2,3]
assert.equals(1, list.first())
assert.equals(1, list.head())
'''.test
Expand All @@ -91,9 +91,9 @@ class ListTest extends ListTestCase {
def void testSortBy() {
'''
var list = [1,2,3]
list.sortBy({x,y => x > y})
list.sortBy({x,y => x > y})
assert.equals([3,2,1], list)
list.sortBy({x,y => x < y})
list.sortBy({x,y => x < y})
assert.equals([1,2,3], list)
'''.test
}
Expand Down Expand Up @@ -130,10 +130,10 @@ class ListTest extends ListTestCase {
@Test
def void testEqualityWithOtherObjects(){
'''
assert.notEquals(2, [])
assert.notEquals(2, [2])
assert.notEquals(2, [2,3,4])
assert.notEquals(console, [])
assert.notEquals(2, [])
assert.notEquals(2, [2])
assert.notEquals(2, [2,3,4])
assert.notEquals(console, [])
'''.test
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package org.uqbar.project.wollok.renaming

import com.google.inject.Inject
import org.eclipse.xtext.common.types.ui.refactoring.participant.JdtRenameParticipant
import org.uqbar.project.wollok.scoping.WollokResourceCache
import org.uqbar.project.wollok.scoping.cache.WollokGlobalScopeCache

class WollokResourceRenameParticipant extends JdtRenameParticipant {

Expand Down

0 comments on commit c34e5cd

Please sign in to comment.