I am working on a project in R. In my folder, I have several R files that each contains lots of functions and some codes in the end to test all the functions in that file. Then I have a file called "main.R". I intend to call all the functions that I wrote in other files. I tried to source all those files at the beginning of my "main.R", however, I noticed that when I run "main.R", the test codes written in the sourced files will also run which is not what I want.
Is there any way that I can only source them but not run the tests code? Something like pre-prosser in C++ maybe?