Add some include/prepend tests

This commit is contained in:
Arthur Baars
2021-04-07 17:27:33 +02:00
parent 84f6e902ea
commit 039e8b36a5
5 changed files with 78 additions and 10 deletions

View File

@@ -1384,6 +1384,21 @@ modules/modules.rb:
# 77| getAnOperand/getRightOperand: [ConstantReadAccess] Object
# 78| getStmt: [ClassDeclaration] Bar
# 78| getScopeExpr: [ConstantReadAccess] Foo3
# 83| getStmt: [ModuleDeclaration] IncludeTest
# 84| getStmt: [MethodCall] call to include
# 84| getArgument: [ConstantReadAccess] Test
# 85| getStmt: [ModuleDeclaration] Y
# 85| getScopeExpr: [ConstantReadAccess] Foo1
# 89| getStmt: [ModuleDeclaration] IncludeTest2
# 90| getStmt: [MethodCall] call to include
# 90| getArgument: [ConstantReadAccess] Test
# 91| getStmt: [ModuleDeclaration] Z
# 91| getScopeExpr: [ConstantReadAccess] Foo1
# 95| getStmt: [ModuleDeclaration] PrependTest
# 96| getStmt: [MethodCall] call to prepend
# 96| getArgument: [ConstantReadAccess] Test
# 97| getStmt: [ModuleDeclaration] Y
# 97| getScopeExpr: [ConstantReadAccess] Foo2
operations/operations.rb:
# 1| [Toplevel] operations.rb
# 3| getStmt: [AssignExpr] ... = ...

View File

@@ -11,7 +11,7 @@ moduleBases
| classes.rb:41:1:52:3 | class << ... | ClassDeclaration |
| classes.rb:55:1:56:3 | MyClassInGlobalScope | ClassDeclaration |
| modules.rb:1:1:2:3 | Empty | ModuleDeclaration |
| modules.rb:1:1:82:1 | modules.rb | Toplevel |
| modules.rb:1:1:99:3 | modules.rb | Toplevel |
| modules.rb:4:1:24:3 | Foo | ModuleDeclaration |
| modules.rb:5:3:14:5 | Bar | ModuleDeclaration |
| modules.rb:6:5:7:7 | ClassInFooBar | ClassDeclaration |
@@ -30,6 +30,12 @@ moduleBases
| modules.rb:72:5:73:7 | Bar | ClassDeclaration |
| modules.rb:76:3:80:5 | Foo3 | ModuleDeclaration |
| modules.rb:78:5:79:7 | Bar | ClassDeclaration |
| modules.rb:83:1:87:3 | IncludeTest | ModuleDeclaration |
| modules.rb:85:3:86:5 | Y | ModuleDeclaration |
| modules.rb:89:1:93:3 | IncludeTest2 | ModuleDeclaration |
| modules.rb:91:3:92:5 | Z | ModuleDeclaration |
| modules.rb:95:1:99:3 | PrependTest | ModuleDeclaration |
| modules.rb:97:3:98:5 | Y | ModuleDeclaration |
| toplevel.rb:1:1:5:23 | toplevel.rb | Toplevel |
moduleBaseClasses
| classes.rb:2:1:56:3 | classes.rb | classes.rb:3:1:4:3 | Foo |
@@ -60,15 +66,21 @@ moduleBaseMethods
moduleBaseModules
| classes.rb:2:1:56:3 | classes.rb | classes.rb:15:1:15:20 | MyModule |
| classes.rb:20:1:37:3 | Wibble | classes.rb:35:3:36:5 | ModuleInWibble |
| modules.rb:1:1:82:1 | modules.rb | modules.rb:1:1:2:3 | Empty |
| modules.rb:1:1:82:1 | modules.rb | modules.rb:4:1:24:3 | Foo |
| modules.rb:1:1:82:1 | modules.rb | modules.rb:26:1:35:3 | Foo |
| modules.rb:1:1:82:1 | modules.rb | modules.rb:37:1:46:3 | Bar |
| modules.rb:1:1:82:1 | modules.rb | modules.rb:48:1:57:3 | Bar |
| modules.rb:1:1:82:1 | modules.rb | modules.rb:60:1:61:3 | MyModuleInGlobalScope |
| modules.rb:1:1:82:1 | modules.rb | modules.rb:63:1:81:3 | Test |
| modules.rb:1:1:99:3 | modules.rb | modules.rb:1:1:2:3 | Empty |
| modules.rb:1:1:99:3 | modules.rb | modules.rb:4:1:24:3 | Foo |
| modules.rb:1:1:99:3 | modules.rb | modules.rb:26:1:35:3 | Foo |
| modules.rb:1:1:99:3 | modules.rb | modules.rb:37:1:46:3 | Bar |
| modules.rb:1:1:99:3 | modules.rb | modules.rb:48:1:57:3 | Bar |
| modules.rb:1:1:99:3 | modules.rb | modules.rb:60:1:61:3 | MyModuleInGlobalScope |
| modules.rb:1:1:99:3 | modules.rb | modules.rb:63:1:81:3 | Test |
| modules.rb:1:1:99:3 | modules.rb | modules.rb:83:1:87:3 | IncludeTest |
| modules.rb:1:1:99:3 | modules.rb | modules.rb:89:1:93:3 | IncludeTest2 |
| modules.rb:1:1:99:3 | modules.rb | modules.rb:95:1:99:3 | PrependTest |
| modules.rb:4:1:24:3 | Foo | modules.rb:5:3:14:5 | Bar |
| modules.rb:63:1:81:3 | Test | modules.rb:65:3:68:5 | Foo1 |
| modules.rb:63:1:81:3 | Test | modules.rb:70:3:74:5 | Foo2 |
| modules.rb:63:1:81:3 | Test | modules.rb:76:3:80:5 | Foo3 |
| modules.rb:70:3:74:5 | Foo2 | modules.rb:71:5:71:19 | Foo2 |
| modules.rb:83:1:87:3 | IncludeTest | modules.rb:85:3:86:5 | Y |
| modules.rb:89:1:93:3 | IncludeTest2 | modules.rb:91:3:92:5 | Z |
| modules.rb:95:1:99:3 | PrependTest | modules.rb:97:3:98:5 | Y |

View File

@@ -13,8 +13,17 @@ modules
| modules.rb:70:3:74:5 | Foo2 | ModuleDeclaration | Foo2 |
| modules.rb:71:5:71:19 | Foo2 | ModuleDeclaration | Foo2 |
| modules.rb:76:3:80:5 | Foo3 | ModuleDeclaration | Foo3 |
| modules.rb:83:1:87:3 | IncludeTest | ModuleDeclaration | IncludeTest |
| modules.rb:85:3:86:5 | Y | ModuleDeclaration | Y |
| modules.rb:89:1:93:3 | IncludeTest2 | ModuleDeclaration | IncludeTest2 |
| modules.rb:91:3:92:5 | Z | ModuleDeclaration | Z |
| modules.rb:95:1:99:3 | PrependTest | ModuleDeclaration | PrependTest |
| modules.rb:97:3:98:5 | Y | ModuleDeclaration | Y |
modulesWithScopeExprs
| modules.rb:48:1:57:3 | Bar | modules.rb:48:8:48:10 | Foo |
| modules.rb:85:3:86:5 | Y | modules.rb:85:10:85:13 | Foo1 |
| modules.rb:91:3:92:5 | Z | modules.rb:91:10:91:13 | Foo1 |
| modules.rb:97:3:98:5 | Y | modules.rb:97:10:97:13 | Foo2 |
modulesWithGlobalNameScopeExprs
| modules.rb:60:1:61:3 | MyModuleInGlobalScope |
exprsInModules
@@ -47,6 +56,12 @@ exprsInModules
| modules.rb:70:3:74:5 | Foo2 | 1 | modules.rb:72:5:73:7 | Bar | ClassDeclaration |
| modules.rb:76:3:80:5 | Foo3 | 0 | modules.rb:77:5:77:17 | ... = ... | AssignExpr |
| modules.rb:76:3:80:5 | Foo3 | 1 | modules.rb:78:5:79:7 | Bar | ClassDeclaration |
| modules.rb:83:1:87:3 | IncludeTest | 0 | modules.rb:84:3:84:16 | call to include | MethodCall |
| modules.rb:83:1:87:3 | IncludeTest | 1 | modules.rb:85:3:86:5 | Y | ModuleDeclaration |
| modules.rb:89:1:93:3 | IncludeTest2 | 0 | modules.rb:90:3:90:14 | call to include | MethodCall |
| modules.rb:89:1:93:3 | IncludeTest2 | 1 | modules.rb:91:3:92:5 | Z | ModuleDeclaration |
| modules.rb:95:1:99:3 | PrependTest | 0 | modules.rb:96:3:96:16 | call to prepend | MethodCall |
| modules.rb:95:1:99:3 | PrependTest | 1 | modules.rb:97:3:98:5 | Y | ModuleDeclaration |
methodsInModules
| modules.rb:4:1:24:3 | Foo | modules.rb:16:3:17:5 | method_in_foo | method_in_foo |
| modules.rb:5:3:14:5 | Bar | modules.rb:9:5:10:7 | method_in_foo_bar | method_in_foo_bar |
@@ -68,6 +83,9 @@ modulesInModules
| modules.rb:63:1:81:3 | Test | modules.rb:70:3:74:5 | Foo2 | Foo2 |
| modules.rb:63:1:81:3 | Test | modules.rb:76:3:80:5 | Foo3 | Foo3 |
| modules.rb:70:3:74:5 | Foo2 | modules.rb:71:5:71:19 | Foo2 | Foo2 |
| modules.rb:83:1:87:3 | IncludeTest | modules.rb:85:3:86:5 | Y | Y |
| modules.rb:89:1:93:3 | IncludeTest2 | modules.rb:91:3:92:5 | Z | Z |
| modules.rb:95:1:99:3 | PrependTest | modules.rb:97:3:98:5 | Y | Y |
moduleTypes
| classes.rb:2:1:56:3 | classes.rb | file://:0:0:0:0 | Object |
| classes.rb:3:1:4:3 | Foo | modules.rb:4:1:24:3 | Foo |
@@ -80,7 +98,7 @@ moduleTypes
| classes.rb:35:3:36:5 | ModuleInWibble | classes.rb:35:3:36:5 | Wibble::ModuleInWibble |
| classes.rb:55:1:56:3 | MyClassInGlobalScope | classes.rb:55:1:56:3 | MyClassInGlobalScope |
| modules.rb:1:1:2:3 | Empty | modules.rb:1:1:2:3 | Empty |
| modules.rb:1:1:82:1 | modules.rb | file://:0:0:0:0 | Object |
| modules.rb:1:1:99:3 | modules.rb | file://:0:0:0:0 | Object |
| modules.rb:4:1:24:3 | Foo | modules.rb:4:1:24:3 | Foo |
| modules.rb:5:3:14:5 | Bar | modules.rb:5:3:14:5 | Foo::Bar |
| modules.rb:6:5:7:7 | ClassInFooBar | modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar |
@@ -99,4 +117,10 @@ moduleTypes
| modules.rb:72:5:73:7 | Bar | modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar |
| modules.rb:76:3:80:5 | Foo3 | modules.rb:76:3:80:5 | Test::Foo3 |
| modules.rb:78:5:79:7 | Bar | modules.rb:37:1:46:3 | Bar |
| modules.rb:83:1:87:3 | IncludeTest | modules.rb:83:1:87:3 | IncludeTest |
| modules.rb:85:3:86:5 | Y | modules.rb:85:3:86:5 | Test::Foo1::Y |
| modules.rb:89:1:93:3 | IncludeTest2 | modules.rb:89:1:93:3 | IncludeTest2 |
| modules.rb:91:3:92:5 | Z | modules.rb:91:3:92:5 | ...::Z |
| modules.rb:95:1:99:3 | PrependTest | modules.rb:95:1:99:3 | PrependTest |
| modules.rb:97:3:98:5 | Y | modules.rb:97:3:98:5 | Test::Foo2::Y |
| toplevel.rb:1:1:5:23 | toplevel.rb | file://:0:0:0:0 | Object |

View File

@@ -80,3 +80,20 @@ module Test
end
end
module IncludeTest
include ::Test
module Foo1::Y
end
end
module IncludeTest2
include Test
module Foo1::Z
end
end
module PrependTest
prepend ::Test
module Foo2::Y
end
end

View File

@@ -1,6 +1,6 @@
toplevel
| classes.rb:2:1:56:3 | classes.rb | Toplevel |
| modules.rb:1:1:82:1 | modules.rb | Toplevel |
| modules.rb:1:1:99:3 | modules.rb | Toplevel |
| toplevel.rb:1:1:5:23 | toplevel.rb | Toplevel |
beginBlocks
| toplevel.rb:1:1:5:23 | toplevel.rb | 0 | toplevel.rb:5:1:5:22 | BEGIN { ... } |