https://gitlab.synchro.net/main/sbbs/-/commit/4914fa1d793e33bd0027b3f8
Added Files:
exec/tests/global/except.js rtypes.js
Modified Files:
src/sbbs3/js_archive.c js_bbs.cpp js_com.c js_cryptcon.c js_cryptkeyset.c js_filebase.c js_global.c js_mqtt.c js_msgbase.c js_system.c jsexec.c mailsrvr.c main.cpp sbbs.h
Log Message:
Global JS function parameter validation and updated return types
Many global functions now throw an exception when null or undefined is passed as a required parameter where null or undefined makes no sense.
e.g. "Argument #1 is an unexpected 'null' or 'undefined' value"
Example exception: is-a/has-a type functions will still return false when passed null or undefined.
Changed global function return types:
- write() now always returns undefined
- printf() always returns a string, never undefined or garbage string
- prompt() returns null (not undefined) upon no input (as documented)
sbbs works more like jsexec:
- read(0) now returns an empty string instead of undefined
- readln(0) no longer waits for enter
jsexec works more like sbbs:
- add missing write_raw() global function, alias for write()
Include expected number of argment in "Insufficient Arguments" exception message.
Update JSDOCS for some global methods:
- file_chmod returns boolean, not number
- flags_str requires a minimum of one argument
New tests to validate expected exceptions and return types based on usage.
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net