For blargg's test ROMs, an incomplete source code RE effort can be found
here.
More (much more!) advanced test ROMs can be found
here, although they require emulation of the
PCMXX registers.
As for learning how to program, I'm going to shill
my own stuff, as I've got very positive feedback on it. It's not complete yet, so there's no mention of the APU, but it's at least enough to get a Hello World running.
By the way, the tutorial Pokun linked is very outdated. `gbhw.inc` has been replaced with
hardware.inc, RGBDS has officially deprecated `HOME`, `CODE`, `DATA` and `BSS` sections in favor of `ROM0`, `ROMX`, `ROMX` and `WRAM0`/`WRAMX`, and so on. RGBFIX is used for the header instead of source code macros.
The tutorial is also full of cargo cult - the first four bytes of code in the header need not be this, you can use `di ; jp EntryPoint` for example; the stack should never be put in HRAM, as it provides no benefit and eats space that could otherwise be allocated to fast-access variables. And overall it explains very little.