BrettMayson / arma-rs

GNU General Public License v2.0
42 stars 8 forks source link

Testing during development #10

Closed bastilimbach closed 2 years ago

bastilimbach commented 2 years ago

First of all, thank you so much @BrettMayson for amra-rs! This is such a neat way to develop Arma 3 Extensions in Rust. I'll definitely use it for all my future Arma projects from now on. 👍

I was just wondering how someone would test their code during active development. It's quite the hassle to restart Arma and run a SQF script after each small change. I know there is callExtension-v2.0 from KillZoneKid but this only works on windows and to be honest I'm not quite into downloading random .exe files 😅.

A possible option could be to write a rust binary which executes RVExtensionArgs etc. Maybe something like Extension::run() could be neat. I don't know.

Is there something you can think of?

BrettMayson commented 2 years ago

This is planned for when I have the free time to do it

jonpas commented 2 years ago

I haven't updated it to latest arma-rs yet, but what I did in the past was just have it compile an executable from main.rs, which calls the same entrypoints as the SQF would. You can easily write tests this way and also test it without ever launching Arma, provided you have some example input and outputs of course.

mod lib;

use crate::lib::*; // entrypoints

fn main() {
    println!("Version: {}", version()); // version() is an entrypoint
}