Replaced sure() invocations with '!!' operator in JS tests.

This commit is contained in:
Evgeny Gerashchenko
2012-09-14 17:16:24 +04:00
parent 8e1323bb43
commit ffc4792071
5 changed files with 12 additions and 12 deletions
@@ -226,14 +226,14 @@ class CanvasState(val canvas: HTMLCanvasElement) {
jq(canvas).mousemove {
if (selection != null) {
selection.sure().pos = mousePos(it) - dragOff
selection!!.pos = mousePos(it) - dragOff
valid = false
}
}
jq(canvas).mouseup {
if (selection != null) {
selection.sure().selected = false
selection!!.selected = false
}
selection = null
valid = false
@@ -254,7 +254,7 @@ class CanvasState(val canvas: HTMLCanvasElement) {
var offset = Vector()
var element: HTMLElement? = canvas
while (element != null) {
val el: HTMLElement = element.sure()
val el: HTMLElement = element!!
offset += Vector(el.offsetLeft, el.offsetTop)
element = el.offsetParent
}
@@ -430,7 +430,7 @@ class CanvasState(val canvas: HTMLCanvasElement) {
var offset = Vector()
var element: HTMLElement? = canvas
while (element != null) {
val el: HTMLElement = element.sure()
val el: HTMLElement = element!!
offset += Vector(el.offsetLeft, el.offsetTop)
element = el.offsetParent
}
@@ -128,7 +128,7 @@ class P() : BodyTag("p")
class H1() : BodyTag("h1")
class A() : BodyTag("a") {
public var href : String
get() = attributes["href"].sure()
get() = attributes["href"]!!
set(value) {
attributes["href"] = value
}
@@ -139,7 +139,7 @@ fun makeField(s : String) : Field {
val l1 : Int = o1.size
val l2 = o2.size
l1 - l2
}).sure()
})!!
val data = Array(lines.size) {Array(w.size) {false}}
// workaround
@@ -160,7 +160,7 @@ fun makeField(s : String) : Field {
}
// An excerpt from the Standard Library
val String?.indices : IntRange get() = IntRange(0, this.sure().size)
val String?.indices : IntRange get() = IntRange(0, this!!.size)
fun <K, V> MutableMap<K, V>.set(k : K, v : V) { put(k, v) }
@@ -171,12 +171,12 @@ fun printMaze(str : String) {
* OOOOOOOOOOOOOOOOO
*/
fun makeMaze(s : String) : Maze {
val lines = s.split("\n").sure()
val lines = s.split("\n")!!
val w = max<String?>(lines.toList(), comparator<String?> {o1, o2 ->
val l1 : Int = o1?.size ?: 0
val l2 = o2?.size ?: 0
l1 - l2
}).sure()
})!!
val data = Array<Array<Boolean>>(lines.size) {Array<Boolean>(w.size) {false}}
var start : #(Int, Int)? = null
@@ -184,7 +184,7 @@ fun makeMaze(s : String) : Maze {
for (line in lines.indices) {
for (x in lines[line].indices) {
val c = lines[line].sure()[x]
val c = lines[line]!![x]
data[line][x] = c == 'O'
when (c) {
'I' -> start = #(line, x)
@@ -202,12 +202,12 @@ fun makeMaze(s : String) : Maze {
throw IllegalArgumentException("No goal point in the maze (should be indicated with a '$' sign)")
}
return Maze(w.size, lines.size, data, start.sure(), end.sure())
return Maze(w.size, lines.size, data, start!!, end!!)
}
// An excerpt from the Standard Library
val String?.indices : IntRange get() = IntRange(0, this.sure().size)
val String?.indices : IntRange get() = IntRange(0, this!!.size)
fun <K, V> Map<K, V>.set(k : K, v : V) { put(k, v) }