Honestly the main benefit of .shader_test files, at all, is that it allows us to write shaders without relying on C string concatenation. If there was a better way to do that in C I'd just ditch the text parsing entirely. Sadly even C23 doesn't have them, nor gcc as an extension.
I suppose there are at least two potential options: apply macro stringification to an arbitrary sequence of characters (which I think mostly works as long as they're sufficiently C-like). Or, alternatively, write some custom tool to preprocess .c files. If one of these doesn't seem too distasteful I may look into them anyway, since I imagine we'll have tests that don't use .shader_test files regardless.