mirror of
https://github.com/KLayout/klayout.git
synced 2026-08-29 01:14:35 +02:00
Test for local variables in LQ
This commit is contained in:
Vendored
+5
-1
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user