Luckily for you, since the function is not doing a lot, it would be easy to test it as well. A few seconds you'll spend adding a unit test is worth a potential loss of a few minutes if someone inadvertently modifies the function, or if the function breaks, affected by a change somewhere else.
How could such a simple function possibly break?
An example of a regression
Let's take an example of a dynamically-typed language. You're in the middle of a refactoring for the last two weeks; some calls were already migrated to
newFunc, and there are only a very few which still rely on
oldFunc. New code is well tested, but
oldFunc has no tests at all.
Your colleague starts checking a bug report. It appears that it is related to a narrow piece of code in which, among others,
newFunc is called. In order to fix the bug, your colleague decides to add an argument to
newFunc: it's now
newFunc(args, isSomething) and can be called by specifying either
Your colleague runs unit tests, and, one by one, corrects them by adding the missing parameter to the callers. The test suite is now all green, so he pushes the changes to production.
A few minutes later, the phone starts ringing...
Since you forgot to test
oldFunc, the change wasn't caught up by the test suite. Your colleague introduced a regression because the code was untested. By simply looking at the code, your colleague had no clue that he needed to update
oldFunc and all the callers of
What to test?
As you may guess, there is no need to write all unit tests of
oldFunc: tests of
oldFunc should test only what the actual function is doing, not what some other function which is called is performing.
This means that you should limit yourself to possibly one test.
If the old function is kept only temporarily, you may—if the language has a support for it—decorate the function as obsolete to make the compiler produce a set of warnings for each location in the code which still uses the old function. The next step might be to replace the call to the new function by an exception, to catch a few locations where the function was called, without being caught by the compiler; the test will therefore be modified accordingly to check that the exception was thrown.