Topic 2.1-Using_irccd_test.md

Using irccd test

When you are developing a new plugin, you may want to try every events but sometimes, you are not allowed to do some actions. For instance you may not kick someone or change the topic.

Also, it's not very nice to flood a server by multiple connections and disconnections.

To get rid of these issues, irccd provides a test sub command that allow simulating some IRC events (not all are yet supported). For example, you may test the event onConnect by doing the following command:

 irccd test myscript.lua onConnect

This will find the script named myscript.lua in the current directory and execute it just like if onConnect has been really called.

The test syntax

The test subcommand is quite easy, it takes the arguments in the same order as the function takes, the only exception is that you don't need to provide a server (because it's not connected), a fake server will be provided for you.


Usage examples:

 irccd test myscript.lua onConnect
 irccd test myscript.lua onMessage #staff markand "Hello world!"

Note that I've discarded the server argument. Also, if you want to check the list of available commands, try irccd test without any arguments.

If you want to get examples about commands, you can also try irccd test help cmd where cmd is one of the available.

Previous 2-Plugin_creation.md | Next 2.2-List_of_Events.md

generated by LDoc 1.4.0