Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fdodino committed Jul 19, 2017
1 parent 203e439 commit ac400ec
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ExceptionTestCase extends AbstractWollokInterpreterTestCase {
'''].interpretPropagatingErrors

val counter = interpreter.currentContext.resolve("counter") as WollokObject
assertEquals(0, counter.asNumber)
assertEquals(0, counter.asInteger)
}

@Test
Expand All @@ -58,7 +58,7 @@ class ExceptionTestCase extends AbstractWollokInterpreterTestCase {
}'''.
interpretPropagatingErrors
val counter = interpreter.currentContext.resolve("counter") as WollokObject
assertEquals(1, counter.asNumber)
assertEquals(1, counter.asInteger)
}

@Test
Expand Down Expand Up @@ -86,7 +86,7 @@ class ExceptionTestCase extends AbstractWollokInterpreterTestCase {
'''.
interpretPropagatingErrors
val counter = interpreter.currentContext.resolve("counter") as WollokObject
assertEquals(2, counter.asNumber)
assertEquals(2, counter.asInteger)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class ConstantInferenceTestCase extends AbstractWollokTypeSystemTestCase {
a = b
}
'''.parseAndInfer.asserting [
assertIssues("a = b", "Expecting super type of <<Integer>> but found <<String>> which is not")
assertIssues("a = b", "Expecting super type of <<Number>> but found <<String>> which is not")
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ program p {
// XPECT noIssues
const p = n

// XPECT warnings --> "expected <<Boolean>> but found <<Integer>>" at "p"
// XPECT warnings --> "expected <<Boolean>> but found <<Number>>" at "p"
const number = if (p) 2 else 6

number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ program p {
// XPECT type at unString --> String
const unString = "Hola"

// XPECT type at largo --> Integer
// XPECT type at largo --> Number
const largo = "Hola".size()

// XPECT type at coleccion --> List
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import static org.uqbar.project.wollok.sdk.WollokSDK.*
*/
class WollokJavaConversions {

def static asInteger(WollokObject it) {
asNumber.intValue
}

def static asNumber(WollokObject it) {
((it as WollokObject).getNativeObject(NUMBER) as JavaWrapper<BigDecimal>).wrapped
}
Expand Down

0 comments on commit ac400ec

Please sign in to comment.