If I create a Public Function in a module. Is it possible to test it using the gambas console?
I tried an got "Unknow symbol"
Is it possible to test functions in gambas console?
-
- Regular
- Posts: 117
- Joined: Tue Jul 09, 2024 9:27 am
Re: Is it possible to test functions in gambas console?
If I understand this correctly, you could type the word Stop just after any Dim statements in your function. Run the program in the IDE. The program will stop when it gets to the Stop command. You can use the [F8] key to step through each command to see exactly what's happening. Gambas will display the error when it arrises.
-
- Regular
- Posts: 117
- Joined: Tue Jul 09, 2024 9:27 am
Re: Is it possible to test functions in gambas console?
Actually is other thing:
I want to test a brand new function in console without having to run a program.
Lets suppose a function with a string as argument, Visual Basic (if I am not wrong) allowed to do in console:
? newfunction("test string")
and see the result in console. I think gambas doesn't have this feature.
I want to test a brand new function in console without having to run a program.
Lets suppose a function with a string as argument, Visual Basic (if I am not wrong) allowed to do in console:
? newfunction("test string")
and see the result in console. I think gambas doesn't have this feature.
Last edited by sergioabreu on Wed Jul 10, 2024 2:25 am, edited 1 time in total.
- thatbruce
- Regular
- Posts: 303
- Joined: Sat Sep 04, 2021 11:29 pm
- Location: Sitting at my desk in South Australia
Re: Is it possible to test functions in gambas console?
The function would have to be entirely atomic and could not rely on anything that had occurred before in the program, especially instantiation of any object involved.
So it wold be of little use generally.
What cogier said is how "it is done here".
So it wold be of little use generally.
What cogier said is how "it is done here".
-
- Regular
- Posts: 117
- Joined: Tue Jul 09, 2024 9:27 am
Re: Is it possible to test functions in gambas console?
cogier wrote: ↑Tue Jul 09, 2024 4:51 pm If I understand this correctly, you could type the word Stop just after any Dim statements in your function. Run the program in the IDE. The program will stop when it gets to the Stop command. You can use the [F8] key to step through each command to see exactly what's happening. Gambas will display the error when it arrises.

-
- Regular
- Posts: 117
- Joined: Tue Jul 09, 2024 9:27 am
Re: Is it possible to test functions in gambas console?
You both are right. In gambas the functions are glued with the form/Module and the only way to test it is to run and breakpoint to allow a console testing. Just did it and worked fine.
