From 47effa61d03a72b9d66a013decca0ee149f8c5de Mon Sep 17 00:00:00 2001 From: VaclavT Date: Sun, 7 Nov 2021 12:32:10 +0100 Subject: [PATCH] tests and doc fixes --- doc/Doc.md | 4 ++-- tests/test.lsp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/Doc.md b/doc/Doc.md index 9e36c6a..55b4049 100644 --- a/doc/Doc.md +++ b/doc/Doc.md @@ -125,7 +125,7 @@ `(string-downcase str)`|Returns down cased string |`>>> (string-downcase "ABCDefghchijklmn") => "abcdefghchijklmn"`| `(string-join lst sep)`|Returns string created as elements of concatenation of lst elements separated by sep|`>>> (string-join ("A" "B" "C" "D") ",") => "A,B,C,D"`| `(string-len str)`|Returns string length|`>>> (string-len "abcdef") => 6`| -`(string-substr str pos len`|Returns substring from str starting at pos with len. If pos is negative returns substring from the end of string|`>>> (string-substr "ABCD" -2 2) => "CD"`| +`(string-substr str pos len`|Returns substring from str starting at pos with len. If pos is negative returns substring from the end of string. First character is on pos 0|`>>> (string-substr "ABCD" -2 2) => "CD"`| `(string-find str lookup pos`|Returns position of lookup in str starting on position. First char index is 0. If not found returns nil|`>>> (string-find " long long int;" "long" 2) => 6`| |`(int value)`|Cast an item to an int|`>>> (int 3.41) => 3`| |`(float value)`|Cast item to a float|`>>> (int 3.41) => 3.14`| @@ -158,7 +158,7 @@ |`( make-csv list)`|creates csv string from list of lists|(print (make-csv '(("r1c1" "r1c2") ("r2c1" "r2c2")))) |`(sprintf ..)`||`>>> (sprintf "%s, %d, %.2f" (list "string" 1000 3.14)) => "string, 1000, 3.14"`| |`(thread-create code..)`|Creates new thread, starts evalueating code and returns immediatelly thread id|| -|`(thread-under-lock lockname code)`|Acquire lock with lockname and eval code. ilock currently is only allowd lockname|| +|`(thread-under-lock lockname code)`|Acquire lock with lockname and eval code. "ilock" currently is only allowed lockname|| |`(thread-sleep milisecons)`|Sleeps thread for given amount of miliseconds|| |`(threads-join)`|Wait for all running threads to finish|| |`(try block catch_block [finally_block])`|Evaluates block and if an exception is thrown, evaluates catch_block.Eventually in both cases evals finally_block. Return evaluated last expression from block if no exception or last expression from catch_block, if exception is thrown from block. Variable ml-exception in catch block is available with astring describing exception|| diff --git a/tests/test.lsp b/tests/test.lsp index 3f48cb2..33be7dc 100644 --- a/tests/test.lsp +++ b/tests/test.lsp @@ -26,7 +26,7 @@ (define json_list (parse-json "{\"k1\":\"v1\", \"k2\":42, \"k3\":[\"a\",123,true,false,null]}")) -(thread-create (tcp-server 7777 (lambda (str) (list #t (+ "(print \"" (string-upcase str) "\")"))))) +(thread-create (tcp-server 7778 (lambda (str) (list #t (+ "(print \"" (string-upcase str) "\")"))))) (ut::define-test "result of (and (> 2 1) (> 2 1))" '(ut::assert-true (and (> 2 1) (> 2 1)))) (ut::define-test "result of (or (> 2 1) (> 2 1))" '(ut::assert-true (or (> 2 1) (> 2 1)))) @@ -137,7 +137,7 @@ (ut::define-test "result of create table" '(ut::assert-equal ((0 "table created" 0)) (usql "create table a (i integer not null, s varchar(64), f float null, d date null, b boolean)"))) -(ut::define-test "result tcp-client" '(ut::assert-equal "(print \"ABCD\")" (tcp-client "127.0.0.1" 7777 "abcd"))) +(ut::define-test "result tcp-client" '(ut::assert-equal "(print \"ABCD\")" (tcp-client "127.0.0.1" 7778 "abcd"))) ;(ut::define-test "result of " '(ut::assert-true ) (ut::run-tests)