That's an Apache rewrite of course, but I know you can do similar on MS servers as well with certain modules added on. If the mappings are less precise, you'd need to do a rewrite rule for each page that didn't match the general rule or some such.
But in any case, you would want to both - update the links on your Sharepoint server (update, not redirect - a link isn't redirected on the outbound server). Eventually, these should be pointing to the right places without redirecting. I have no idea how MOSS works, but for this sort of thing, I usually grep for the URL in question and change it where needed and then reupload the database (or use sed to change the files if that's more appropriate). I have no idea what the Microsoft equivalent would be to do doing that, but things like PowerGREP can handle that sort of text manipulation on a Windows machine. But maybe it's just a setting (like I say, I don't know MOSS).
- redirect the target links on test.example.com so that old links around the web to your test.example.com domain don't go bad. Ideally, you'd try some general rule that would handle most cases and you'd look at your sever logs and at least get the top 100 pages redirected to their equivalent on the new site.