(PUP-4178) Complete defined() function and spec tests
Before this, the tests were not covering all variants. This commit
organizes the spec test for the defined function from a usage
perspective. To ask if a class is defined, if a resource is defined, a
variable etc. Tests were also added for numeric (match) variables.
This revealed that it was not possible to be specific about if a name
must be a reference to a class, defined or resource type.
This commit also adds the ability to be specific by using a meta type.
Thus, defined(Type[Class[foo]]) returns true iff foo is a class, and
defined(Type[Resource[foo]]) returns true iff foo is a build in or
defined resource type.