From e3a59c0e26d9e26ec49f24abfd118f517b192e90 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Mon, 11 Jul 2022 06:28:32 +0800 Subject: [PATCH] cleanup: Split large test + delete scratchpad test. --- test/scip/testdata/.gitignore | 1 + test/scip/testdata/args.rb | 11 ++++ test/scip/testdata/args.snapshot.rb | 26 ++++++++ test/scip/testdata/arrays.rb | 9 +++ test/scip/testdata/arrays.snapshot.rb | 24 +++++++ test/scip/testdata/functions.rb | 11 ++++ test/scip/testdata/functions.snapshot.rb | 19 ++++++ test/scip/testdata/hashes.rb | 7 ++ test/scip/testdata/hashes.snapshot.rb | 18 +++++ test/scip/testdata/s.rb | 13 ---- test/scip/testdata/s.snapshot.rb | 22 ------- test/scip/testdata/syntax.rb | 36 ---------- test/scip/testdata/syntax.snapshot.rb | 83 ------------------------ 13 files changed, 126 insertions(+), 154 deletions(-) create mode 100644 test/scip/testdata/.gitignore create mode 100644 test/scip/testdata/args.rb create mode 100644 test/scip/testdata/args.snapshot.rb create mode 100644 test/scip/testdata/arrays.rb create mode 100644 test/scip/testdata/arrays.snapshot.rb create mode 100644 test/scip/testdata/functions.rb create mode 100644 test/scip/testdata/functions.snapshot.rb create mode 100644 test/scip/testdata/hashes.rb create mode 100644 test/scip/testdata/hashes.snapshot.rb delete mode 100644 test/scip/testdata/s.rb delete mode 100644 test/scip/testdata/s.snapshot.rb delete mode 100644 test/scip/testdata/syntax.rb delete mode 100644 test/scip/testdata/syntax.snapshot.rb diff --git a/test/scip/testdata/.gitignore b/test/scip/testdata/.gitignore new file mode 100644 index 0000000000..7a5af7a34b --- /dev/null +++ b/test/scip/testdata/.gitignore @@ -0,0 +1 @@ +tmp* diff --git a/test/scip/testdata/args.rb b/test/scip/testdata/args.rb new file mode 100644 index 0000000000..45664f7d7c --- /dev/null +++ b/test/scip/testdata/args.rb @@ -0,0 +1,11 @@ +# typed: true + +def args(x, y) + z = x + y + if x == 2 + z += y + else + z += x + end + z +end diff --git a/test/scip/testdata/args.snapshot.rb b/test/scip/testdata/args.snapshot.rb new file mode 100644 index 0000000000..837108d1b2 --- /dev/null +++ b/test/scip/testdata/args.snapshot.rb @@ -0,0 +1,26 @@ + # typed: true + + def args(x, y) +#^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO args(). +#^^^^^^^^^^ definition scip-ruby gem TODO TODO (). +# ^ definition local 1~#2634721084 +# ^ definition local 2~#2634721084 + z = x + y +# ^ definition local 3~#2634721084 +# ^ reference local 1~#2634721084 +# ^ reference local 2~#2634721084 + if x == 2 +# ^ reference local 1~#2634721084 + z += y +# ^ reference local 3~#2634721084 +# ^ reference (write) local 3~#2634721084 +# ^ reference local 2~#2634721084 + else + z += x +# ^ reference local 3~#2634721084 +# ^ reference (write) local 3~#2634721084 +# ^ reference local 1~#2634721084 + end + z +# ^ reference local 3~#2634721084 + end diff --git a/test/scip/testdata/arrays.rb b/test/scip/testdata/arrays.rb new file mode 100644 index 0000000000..dec8895b53 --- /dev/null +++ b/test/scip/testdata/arrays.rb @@ -0,0 +1,9 @@ +# typed: true + +def arrays(a, i) + a[0] = 0 + a[1] = a[2] + a[i] = a[i + 1] + b = a[2..-1] + a << a[-1] +end diff --git a/test/scip/testdata/arrays.snapshot.rb b/test/scip/testdata/arrays.snapshot.rb new file mode 100644 index 0000000000..a455a4d3f4 --- /dev/null +++ b/test/scip/testdata/arrays.snapshot.rb @@ -0,0 +1,24 @@ + # typed: true + + def arrays(a, i) +#^^^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO arrays(). +#^^^^^^^^ definition scip-ruby gem TODO TODO (). +# ^ definition local 1~#513334479 +# ^ definition local 2~#513334479 + a[0] = 0 +# ^ reference local 1~#513334479 + a[1] = a[2] +# ^ reference local 1~#513334479 +# ^ reference local 1~#513334479 + a[i] = a[i + 1] +# ^ reference local 1~#513334479 +# ^ reference local 2~#513334479 +# ^ reference local 1~#513334479 +# ^ reference local 2~#513334479 + b = a[2..-1] +# ^ definition local 3~#513334479 +# ^ reference local 1~#513334479 + a << a[-1] +# ^ reference local 1~#513334479 +# ^ reference local 1~#513334479 + end diff --git a/test/scip/testdata/functions.rb b/test/scip/testdata/functions.rb new file mode 100644 index 0000000000..b500c94cfa --- /dev/null +++ b/test/scip/testdata/functions.rb @@ -0,0 +1,11 @@ +# typed: true + +def globalFn1() + x = 10 + x +end + +def globalFn2() + x = globalFn1() +end + diff --git a/test/scip/testdata/functions.snapshot.rb b/test/scip/testdata/functions.snapshot.rb new file mode 100644 index 0000000000..9d271ccff4 --- /dev/null +++ b/test/scip/testdata/functions.snapshot.rb @@ -0,0 +1,19 @@ + # typed: true + + def globalFn1() +#^^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO globalFn1(). +#^^^^^^^^^ definition scip-ruby gem TODO TODO (). + x = 10 +# ^ definition local 1~#3846536873 + x +# ^ reference local 1~#3846536873 + end + + def globalFn2() +#^^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO globalFn2(). + x = globalFn1() +# ^ definition local 1~#3796204016 +# ^^^^^^^^^^^^^^^ reference local 1~#3796204016 +# ^^^^^^^^^ reference scip-ruby gem TODO TODO globalFn1(). + end + diff --git a/test/scip/testdata/hashes.rb b/test/scip/testdata/hashes.rb new file mode 100644 index 0000000000..6c644d01f3 --- /dev/null +++ b/test/scip/testdata/hashes.rb @@ -0,0 +1,7 @@ +# typed: true + +def hashes(h, k) + h["hello"] = "world" + old = h["world"] + h[k] = h[old] +end diff --git a/test/scip/testdata/hashes.snapshot.rb b/test/scip/testdata/hashes.snapshot.rb new file mode 100644 index 0000000000..06b6fb3f42 --- /dev/null +++ b/test/scip/testdata/hashes.snapshot.rb @@ -0,0 +1,18 @@ + # typed: true + + def hashes(h, k) +#^^^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO hashes(). +#^^^^^^ definition scip-ruby gem TODO TODO (). +# ^ definition local 1~#1685166589 +# ^ definition local 2~#1685166589 + h["hello"] = "world" +# ^ reference local 1~#1685166589 + old = h["world"] +# ^^^ definition local 3~#1685166589 +# ^ reference local 1~#1685166589 + h[k] = h[old] +# ^ reference local 1~#1685166589 +# ^ reference local 2~#1685166589 +# ^ reference local 1~#1685166589 +# ^^^ reference local 3~#1685166589 + end diff --git a/test/scip/testdata/s.rb b/test/scip/testdata/s.rb deleted file mode 100644 index 967b67ec48..0000000000 --- a/test/scip/testdata/s.rb +++ /dev/null @@ -1,13 +0,0 @@ -# typed: true - -def case(x, y) - case x - when 0 - x = 3 - when (3 == (x = 1)) - x = 0 - else - x = 1 - end - return -end diff --git a/test/scip/testdata/s.snapshot.rb b/test/scip/testdata/s.snapshot.rb deleted file mode 100644 index 9d7da15176..0000000000 --- a/test/scip/testdata/s.snapshot.rb +++ /dev/null @@ -1,22 +0,0 @@ - # typed: true - - def case(x, y) -#^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO case(). -#^^^^^^^^^^^^ definition scip-ruby gem TODO TODO (). -# ^ definition local 1~#2602907825 - case x -# ^ reference local 1~#2602907825 - when 0 - x = 3 -# ^ reference (write) local 1~#2602907825 - when (3 == (x = 1)) -# ^ reference (write) local 1~#2602907825 -# ^^^^^ reference local 1~#2602907825 - x = 0 -# ^ reference (write) local 1~#2602907825 - else - x = 1 -# ^ reference (write) local 1~#2602907825 - end - return - end diff --git a/test/scip/testdata/syntax.rb b/test/scip/testdata/syntax.rb deleted file mode 100644 index 58060ab293..0000000000 --- a/test/scip/testdata/syntax.rb +++ /dev/null @@ -1,36 +0,0 @@ -# typed: true - -_ = 0 # stub for global - -def globalFn1() - x = 10 - x -end - -def globalFn2() - x = globalFn1() -end - -def args(x, y) - z = x + y - if x == 2 - z += y - else - z += x - end - z -end - -def arrays(a, i) - a[0] = 0 - a[1] = a[2] - a[i] = a[i + 1] - b = a[2..-1] - a << a[-1] -end - -def hashes(h, k) - h["hello"] = "world" - old = h["world"] - h[k] = h[old] -end \ No newline at end of file diff --git a/test/scip/testdata/syntax.snapshot.rb b/test/scip/testdata/syntax.snapshot.rb deleted file mode 100644 index e404953c91..0000000000 --- a/test/scip/testdata/syntax.snapshot.rb +++ /dev/null @@ -1,83 +0,0 @@ - # typed: true - - _ = 0 # stub for global -#^ definition local 1~#119448696 -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO (). - - def globalFn1() -#^^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO globalFn1(). - x = 10 -# ^ definition local 1~#3846536873 - x -# ^ reference local 1~#3846536873 - end - - def globalFn2() -#^^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO globalFn2(). - x = globalFn1() -# ^ definition local 1~#3796204016 -# ^^^^^^^^^^^^^^^ reference local 1~#3796204016 -# ^^^^^^^^^ reference scip-ruby gem TODO TODO globalFn1(). - end - - def args(x, y) -#^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO args(). -# ^ definition local 1~#2634721084 -# ^ definition local 2~#2634721084 - z = x + y -# ^ definition local 3~#2634721084 -# ^ reference local 1~#2634721084 -# ^ reference local 2~#2634721084 - if x == 2 -# ^ reference local 1~#2634721084 - z += y -# ^ reference (write) local 3~#2634721084 -# ^ reference local 3~#2634721084 -# ^ reference local 2~#2634721084 - else - z += x -# ^ reference local 3~#2634721084 -# ^ reference (write) local 3~#2634721084 -# ^ reference local 1~#2634721084 - end - z -# ^ reference local 3~#2634721084 - end - - def arrays(a, i) -#^^^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO arrays(). -# ^ definition local 1~#513334479 -# ^ definition local 2~#513334479 - a[0] = 0 -# ^ reference local 1~#513334479 - a[1] = a[2] -# ^ reference local 1~#513334479 -# ^ reference local 1~#513334479 - a[i] = a[i + 1] -# ^ reference local 1~#513334479 -# ^ reference local 2~#513334479 -# ^ reference local 1~#513334479 -# ^ reference local 2~#513334479 - b = a[2..-1] -# ^ definition local 3~#513334479 -# ^ reference local 1~#513334479 - a << a[-1] -# ^ reference local 1~#513334479 -# ^ reference local 1~#513334479 - end - - def hashes(h, k) -#^^^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO hashes(). -# ^ definition local 1~#1685166589 -# ^ definition local 2~#1685166589 - h["hello"] = "world" -# ^ reference local 1~#1685166589 - old = h["world"] -# ^^^ definition local 3~#1685166589 -# ^ reference local 1~#1685166589 - h[k] = h[old] -# ^ reference local 1~#1685166589 -# ^ reference local 2~#1685166589 -# ^ reference local 1~#1685166589 -# ^^^ reference local 3~#1685166589 - end