You've already forked libadalang
mirror of
https://github.com/AdaCore/libadalang.git
synced 2026-02-12 12:28:54 -08:00
On Windows, the default encoding (not UTF-8) may not allow non-ASCII test outputs. Use Python's "ascii" builtin where needed to ensure pure ASCII test outputs. TN: U720-016
21 lines
509 B
Python
21 lines
509 B
Python
"""
|
|
Test that StringLiteral.p_denoted_value properly decodes all valid Ada string
|
|
literals.
|
|
"""
|
|
|
|
import libadalang as lal
|
|
|
|
|
|
c = lal.AnalysisContext('utf-8')
|
|
u = c.get_from_file('foo.ads')
|
|
|
|
for decl in u.root.findall(lal.ObjectDecl):
|
|
name = decl.f_ids.text
|
|
expr = decl.f_default_expr
|
|
assert isinstance(expr, lal.StringLiteral)
|
|
try:
|
|
v = expr.p_denoted_value
|
|
except lal.PropertyError:
|
|
v = u'<PropertyError>'
|
|
print('{} ({}) -> {}'.format(name, ascii(expr.text), ascii(v)))
|