# file      : tests/variable/target-specific/testscript
# license   : MIT; see accompanying LICENSE file

.include ../../common.testscript

: basic
:
$* <<EOI >>EOO
x = x
./: x = X
file{foo}: [uint64] y=00
sub/
{
  file{foo}: z = Z
}
print $x
print $(./: x)
print $(file{foo}: y)
print $(sub/file{foo}: z)
EOI
x
X
0
Z
EOO

: block
:
$* <<EOI >>EOO
x = x
./:
{
  x = X
  y = $x
}
print $(./: x)
print $(./: y)
EOI
X
X
EOO

: block-multiple
:
$* <<EOI >>EOO
x = x
file{foo} file{bar}:
{
  x += X
  y = $x
}
print $(file{foo}: y)
print $(file{bar}: y)
EOI
x X
x X
EOO

: eval-qual
:
$* <<EOI >>EOO
print (foo:bar)
print (foo :bar)
print (foo: bar)
print (foo : bar)
print (foo/: bar)
print (foo/file{fox}: bar)
print (file{fox}@./: bar)
EOI
bar:foo
bar:foo
bar:foo
bar:foo
bar:foo/
bar:foo/file{fox}
bar:file{fox}@./
EOO

: eval-qual-name-expected
:
$* <<EOI 2>>EOE != 0
print (foo:)
EOI
<stdin>:1:12: error: expected name instead of ')'
EOE

: eval-qual-target-expected
:
$* <<EOI 2>>EOE != 0
print (:foo)
EOI
<stdin>:1:8: error: expected target before ':'
EOE
