Added comprehensive result verification and assertions to ensure correctness:
go/token demo:
- Verify Pos values and IsValid() results
- Check token string representations
- Validate keyword detection (IsKeyword())
- Assert operator precedence relationships
- Verify file and position operations
go/types demo:
- Validate basic type kinds
- Check object names and types (Var, Const, Func, TypeName)
- Verify package path and name
- Assert interface method counts and names
- Check struct field counts, names, and types
- Validate signature params and results
- Verify tuple, array, slice, pointer, map, and chan properties
All demos now fail fast with panic() if results don't match expected values,
providing better test coverage than just printing output.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
Expanded demo tests to cover more public methods and functions from go/types and go/token packages, as discovered via `go doc`.
**go/types additions:**
- Type comparison functions: Identical, AssignableTo, Comparable, ConvertibleTo
- Interface checking: Implements, AssertableTo
- String formatting: TypeString, ObjectString with qualifiers
- Lookup utilities: LookupFieldOrMethod, NewMethodSet
- Type utilities: IsInterface, Default, Id
**go/token additions:**
- Utility functions: IsExported, IsIdentifier, IsKeyword, Lookup
These additions provide better coverage of the packages' public APIs and demonstrate proper usage patterns for interface conversions and method calls.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
- Removed header/footer print statements from main()
- Added '\n' prefix to section headers (except first) for consistent spacing
- Follows the pattern established in maphash and other demo files
This makes the output cleaner and consistent with other demo files in the project.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>