I'm not sure which version of puppet you are using, since you didn't mention it. The "file_name" class belongs to the puppetlabs-stdlib library, so you need to make sure that this module is installed -
puppet module install puppetlabs-stdlib
also, since you are using a module path, you need to call your file init.pp (not test.pp). Since you are new to writing modules, I suggest you use the puppet module generate command -
puppet module generate module-name --skip-interview
this will create all you'll need for a new module. don't forget to make sure that the class name is the same as the module's name. In order to run and test this module, use -
puppet apply -e "include <module-name>"