Skip to content

Commit 611d03c

Browse files
committed
test variable scope on terms
1 parent 745375d commit 611d03c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/variable_scope.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
using ModelingToolkit
22
using Test
33

4-
@variables a b c d
4+
@parameters t
5+
@variables a b(t) c d
56

67
b = ParentScope(b)
78
c = ParentScope(ParentScope(c))
89
d = GlobalScope(d)
910

10-
renamed(nss, sym) = nameof(foldr(ModelingToolkit.renamespace, nss, init=sym))
11+
renamed(nss, sym) = ModelingToolkit.getname(foldr(ModelingToolkit.renamespace, nss, init=sym))
1112

1213
@test renamed([:foo :bar :baz], a) == :foo₊bar₊baz₊a
1314
@test renamed([:foo :bar :baz], b) == :foo₊bar₊b
@@ -26,7 +27,7 @@ eqs = [
2627
@named sub1 = NonlinearSystem([], [], [], systems=[sub2])
2728
@named sys = NonlinearSystem([], [], [], systems=[sub1])
2829

29-
names = nameof.(states(sys))
30+
names = ModelingToolkit.getname.(states(sys))
3031
@test :d in names
3132
@test :sub1₊c in names
3233
@test :sub1₊sub2₊b in names

0 commit comments

Comments
 (0)