diff --git a/README.md b/README.md index d7e4f8bd5..57b69a27a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ -* Documentation: [doc/main.md](doc/main.md) +* Documentation: [https://github.com/SuperFola/Ark/wiki](Wiki) **Nota bene**: the project is referred as "Ark" and as "ArkScript". The official public name is "ArkScript" since "Ark" is already being used by [another language](https://github.com/ark-lang/ark) @@ -15,7 +15,7 @@ * Ark is small: the compiler, and the virtual machines fit under 5000 lines, but also small in term of keywords (it has only 10)! * Ark is a scripting language: it's very easy to embed it in your application. The FFI is quite easy to understand, so adding your own functions to the virtual machine is effortless * Ark can run everywhere: it produces a bytecode which is run by its virtual machine, like Java but without the `OutOfMemoryException` -* Ark is a functional language: every parameters are by passed by value, everything is immutable unless you use `mut` to define a mutable variable +* Ark is a functional language: every parameters are passed by value, everything is immutable unless you use `mut` to define a mutable variable * Ark can handle object oriented programming in a very elegant way with its closures and explicit captures (see examples/church-encoding) * Ark is promoting functionalities before performances: expressiveness often brings more productivity, but performances aren't bad at all * Ark handles first class objects, thus it has higher-order functions diff --git a/tests/unittest.ark b/tests/unittest.ark index a42337a91..85284545d 100644 --- a/tests/unittest.ark +++ b/tests/unittest.ark @@ -54,7 +54,7 @@ (set passed (+ 1 passed)) })) (math-tests) - (print "Math tests passed") + (print " Math tests passed") # -------------------------- # Strings @@ -91,7 +91,7 @@ (set passed (+ 1 passed)) })) (string-tests) - (print "String tests passed") + (print " String tests passed") # -------------------------- # List @@ -130,7 +130,7 @@ (set passed (+ 1 passed)) })) (list-tests) - (print "List tests passed") + (print " List tests passed") # -------------------------- # misc @@ -182,7 +182,7 @@ (set passed (+ 1 passed)) })) (misc-tests) - (print "Misc tests passed") + (print " Misc tests passed") # -------------------------- # switch @@ -201,7 +201,7 @@ ]) })) (switch-tests) - (print "Switch tests passed") + (print " Switch tests passed") # -------------------------- # defer @@ -225,7 +225,7 @@ (set passed (+ 1 passed)) })) (defer-tests) - (print "Defer tests passed") + (print " Defer tests passed") # -------------------------- # recursion @@ -255,7 +255,7 @@ (assert (= (fibo 16) 987) "Fibo 16 test failed") (set passed (+ 1 passed)) - (print "Recursion tests passed") + (print " Recursion tests passed") # -------------------------- # callbacks @@ -293,7 +293,7 @@ (set passed (+ 1 passed)) })) (callbacks-tests) - (print "Callback tests passed") + (print " Callback tests passed") # -------------------------- # OOP @@ -321,7 +321,7 @@ (set passed (+ 1 passed)) })) (oop-test) - (print "OOP tests passed") + (print " OOP tests passed") # -------------------------- # Errors @@ -341,7 +341,7 @@ (set passed (+ 1 passed)) })) (error-tests) - (print "Error tests passed") + (print " Error tests passed") # -------------------------- # Ranges @@ -358,7 +358,7 @@ (set passed (+ 1 passed)) })) (range-test) - (print "Range tests passed") + (print " Range tests passed") # -------------------------- # Del @@ -371,7 +371,28 @@ (set passed (+ 1 passed)) })) (del-test) - (print "Del tests passed") + (print " Del tests passed") + + # -------------------------- + # Scopes + # -------------------------- + (let scope-tests (fun () { + (let foo (fun () {x})) + + (let dummy1 (fun () { + (let x 5) + (foo)})) + + (let dummy2 (fun () { + (let x 10) + (foo)})) + + (assert (= 5 (dummy1)) "Scope test 1 failed") + (assert (= 10 (dummy2)) "Scope test 1°2 failed") + (set passed (+ 1 passed)) + })) + (scope-tests) + (print " Scope tests passed") (print passed "tests passed!") (print "Completed in" (toString (- (time) start_time)) "seconds")