-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1715 from uqbar-project/feature-#1692-change-toSt…
…ring-of-Date Feature #1692 change to string of date
- Loading branch information
Showing
9 changed files
with
171 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
...ar.project.wollok.tests/src/org/uqbar/project/wollok/tests/interpreter/PairTestCase.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
package org.uqbar.project.wollok.tests.interpreter | ||
|
||
import org.junit.Test | ||
|
||
class PairTestCase extends AbstractWollokInterpreterTestCase { | ||
|
||
@Test | ||
def void smokeTest() { | ||
''' | ||
const pair = new Pair(1, 1) | ||
assert.equals(pair, pair) | ||
'''.test | ||
} | ||
|
||
@Test | ||
def void testNewContructor() { | ||
''' | ||
const pair = new Pair(1, 2) | ||
assert.equals(1, pair.x()) | ||
assert.equals(2, pair.y()) | ||
'''.test | ||
} | ||
|
||
@Test | ||
def void testArrowContructor() { | ||
''' | ||
const pair = 1->2 | ||
assert.equals(1, pair.x()) | ||
assert.equals(2, pair.y()) | ||
'''.test | ||
} | ||
|
||
@Test | ||
def void testXGetter() { | ||
''' | ||
const pair = "1"->2 | ||
assert.equals("1", pair.x()) | ||
'''.test | ||
} | ||
|
||
@Test | ||
def void testYGetter() { | ||
''' | ||
const pair = 1->"2" | ||
assert.equals("2", pair.y()) | ||
'''.test | ||
} | ||
|
||
@Test | ||
def void testXSetterThrowsCannotModifyConstantPropertyException() { | ||
''' | ||
const pair = 1->2 | ||
assert.throwsExceptionWithMessage("Cannot modify constant property x", { pair.x(10) }) | ||
'''.test | ||
} | ||
|
||
@Test | ||
def void testYSetterThrowsCannotModifyConstantPropertyException() { | ||
''' | ||
const pair = 1->2 | ||
assert.throwsExceptionWithMessage("Cannot modify constant property y", { pair.y(20) }) | ||
'''.test | ||
} | ||
|
||
@Test | ||
def void testKeyGetter() { | ||
''' | ||
const pair = 10->20 | ||
assert.equals(10, pair.key()) | ||
'''.test | ||
} | ||
|
||
@Test | ||
def void testValueGetter() { | ||
''' | ||
const pair = 10->20 | ||
assert.equals(20, pair.value()) | ||
'''.test | ||
} | ||
|
||
@Test | ||
def void testKeySetterThrowsMessageNotUnderstoodException() { | ||
''' | ||
const pair = 1->2 | ||
assert.throwsExceptionWithType(new MessageNotUnderstoodException(), { pair.key(10) }) | ||
'''.test | ||
} | ||
|
||
@Test | ||
def void testValueSetterThrowsMessageNotUnderstoodException() { | ||
''' | ||
const pair = 1->2 | ||
assert.throwsExceptionWithType(new MessageNotUnderstoodException(), { pair.value(20) }) | ||
'''.test | ||
} | ||
|
||
@Test | ||
def void testToStringRepresentation() { | ||
''' | ||
const pair = 10->20 | ||
assert.equals("10 -> 20", pair.toString()) | ||
'''.test | ||
} | ||
|
||
@Test | ||
def void testShortDescriptionRepresentation() { | ||
''' | ||
const pair = 10->20 | ||
assert.equals("10 -> 20", pair.shortDescription()) | ||
'''.test | ||
} | ||
} |
Oops, something went wrong.