mirror of https://github.com/KLayout/klayout.git
Test for local variables in LQ
This commit is contained in:
parent
49c1bacb98
commit
3514fad64a
|
|
@ -77,6 +77,7 @@ class DBLayoutQuery_TestClass < TestBase
|
|||
ctx = RBA::ExpressionContext::new
|
||||
ctx.var("suffix", "!")
|
||||
ctx.var("all", [])
|
||||
ctx.var("nonmod", "")
|
||||
|
||||
q = RBA::LayoutQuery::new("select cell.name + suffix from *")
|
||||
res = []
|
||||
|
|
@ -88,10 +89,13 @@ class DBLayoutQuery_TestClass < TestBase
|
|||
assert_equal(res[0], "[\"TOPTOP!\"]")
|
||||
assert_equal(res[1], "[\"TOP!\"]")
|
||||
|
||||
q = RBA::LayoutQuery::new("with * do all.push(cell.name)")
|
||||
q = RBA::LayoutQuery::new("with * do var nonmod = cell.name; all.push(nonmod)")
|
||||
q.execute(ly, ctx)
|
||||
|
||||
assert_equal(ctx.eval("all").join(","), "TOPTOP,TOP")
|
||||
# not modified, because we used "var nonmod" in the query which
|
||||
# creates a local variable:
|
||||
assert_equal(ctx.eval("nonmod"), "")
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue