Skip to content

Commit

Permalink
ooops, forgot about those files
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasdr committed Jan 13, 2024
1 parent e0086ef commit 365ecae
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
39 changes: 39 additions & 0 deletions resources/miniscript/tests/loop-test.tscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# initialize
on: initialize
console.log("-----------------------")
console.log("loop-test: Initialize")
console.log("-----------------------")
console.log()
end

# if no condition is met, nothing will be executed, lol :D
on: nothing
console.log("--------------------")
console.log("loop-test: Nothing")
console.log("--------------------")
console.log()
$array = [1,2,3,4,5,6]
$i = 0
# tests for continue, break
# if successfull we should see 1, 2, 4
forCondition($i < $array->length())
$i++
if ($i == 3)
continue
end
if ($i == 5)
break
end
console.log($i)
end
script.stop()
end

# an error has occurred
on: error
console.log("------------------")
console.log("loop-test: Error")
console.log("------------------")
console.log("An error occurred")
script.stop()
end
34 changes: 34 additions & 0 deletions resources/miniscript/tests/preprocessor-test.tscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# initialize
on: initialize
console.log("-------------------------------")
console.log("preprocessor-test: Initialize")
console.log("------------------------------")
console.log()
end

# if no condition is met, nothing will be executed, lol :D
on: nothing
console.log("----------------------------")
console.log("preprocessor-test: Nothing")
console.log("----------------------------")
console.log()
$i = 0
# postfix, prefix operator
console.log("$i: " + $i)
console.log("++$i: " + (++$i))
console.log("$i++: " + ($i++))
console.log("$i: " + $i)
# 2 argument operator with left and right arguments
console.log("10 * 10: " + 10 * 10)
#
script.stop()
end

# an error has occurred
on: error
console.log("--------------------------")
console.log("preprocessor-test: Error")
console.log("--------------------------")
console.log()
script.stop()
end

0 comments on commit 365ecae

Please sign in to comment.