One option seems to be to create a folder named "test" and give it it's own copy of app_dev.php and .htaccess
You may need to tweak the last line. The default .htaccess file doesn't use %{DOCUMENT_ROOT} but my setup requires it.
RewriteEngine On
RewriteOptions Inherit
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/test/app_dev.php [QSA,L]
Then you need to edit test/app_dev.php to add an extra "../" to the require statements.
A quick test on one of my projects shows that this seems to work.
Update
I don't believe this is possible simply with rewrite rules. This is my attempt at modifying my web/.htaccess file to work. My understanding is that if you request /test/foo, the URL is rewritten to internally become /app_dev.php/foo. However the way Symfony finds the URL that it tries to route somehow always finds out the URL was /test/foo and I get a route not found exception.
RewriteEngine On
RewriteOptions Inherit
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^test/(.*)$ %{DOCUMENT_ROOT}/app_dev.php/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/app.php [QSA,L]
If I add change my app_dev.php line to use [QSA,L,R=301] it does redirect the browser to /app_dev.php/foo and gives me the intended page. Since it doesn't hide the app_dev.php it's probably not what you're looking for, but it verifies that the match is working correctly.