fix declarations method to read trimmed ast
fix trim method test code