remove caas

This commit is contained in:
Arne Döring
2018-11-27 23:47:21 +01:00
committed by Araq
parent ef44c12a34
commit 75e4a0098a
28 changed files with 0 additions and 534 deletions

View File

@@ -1,29 +0,0 @@
# Tries to test the full ownership path generated by idetools.
proc lev1(t1: string) =
var temp = t1
for i in 0..len(temp)-1:
temp[i] = chr(int(temp[i]) + 1)
proc lev2(t2: string) =
var temp = t2
for i in 0..len(temp)-1:
temp[i] = chr(int(temp[i]) + 1)
proc lev3(t3: string) =
var temp = t3
for i in 0..len(temp)-1:
temp[i] = chr(int(temp[i]) + 1)
proc lev4(t4: string) =
var temp = t4
for i in 0..len(temp)-1:
temp[i] = chr(int(temp[i]) + 1)
echo temp & "(lev4)"
lev4(temp & "(lev3)")
lev3(temp & "(lev2)")
lev2(temp & "(lev1)")
when isMainModule:
lev1("abcd")

View File

@@ -1,29 +0,0 @@
absurd_nesting.nim
> c --verbosity:0 --hints:on
SuccessX
> idetools --track:$TESTNIM,6,6 --def $SILENT
skVar\tabsurd_nesting.lev1.temp\tstring
> idetools --track:$TESTNIM,21,13 --def $SILENT
skVar\tabsurd_nesting.lev1.lev2.lev3.lev4.temp\tstring
> idetools --track:$TESTNIM,6,27 --def $SILENT
skForVar\tabsurd_nesting.lev1.i\tint
> idetools --track:$TESTNIM,21,33 --def $SILENT
skForVar\tabsurd_nesting.lev1.lev1.lev3.lev4.i\tint
> idetools --track:$TESTNIM,24,8 --def $SILENT
skProc\tabsurd_nesting.lev1.lev1.lev3.lev4\tproc \(string\)
> idetools --track:$TESTNIM,4,13 --def $SILENT
skParam\tabsurd_nesting.lev1.t1\tstring
> idetools --track:$TESTNIM,4,13 --def $SILENT
skParam\tabsurd_nesting.lev1.t1\tstring
> idetools --track:$TESTNIM,19,19 --def $SILENT
skParam\tabsurd_nesting.lev1.lev2.lev3.lev4.t4\tstring

View File

@@ -1,10 +0,0 @@
main.nim
> c --verbosity:0 --hints:on
SuccessX
# The "Processing" string will be found always in proc mode since each
# compilation command will generate it. We need to test it only in Caas mode to
# verify the server is not recompiling again the file.
CaasRun > c --verbosity:0 --hints:on
CaasRun ! Processing
CaasRun SuccessX

View File

@@ -1,7 +0,0 @@
main.nim
> c --verbosity:0 --hints:on
SuccessX
> idetools --trackDirty:main_dirty.nim,$TESTNIM,12,7 --suggest $SILENT
skField\tx
skField\ty

View File

@@ -1,11 +0,0 @@
main.nim
> c --verbosity:0 --hints:on
SuccessX
> idetools --track:$TESTNIM,5,18 --def --verbosity:0 --hints:on
strutils.toUpper
! SuccessX
> idetools --track:$TESTNIM,5,18 --def --verbosity:0 --hints:on
strutils.toUpper
! SuccessX

View File

@@ -1,9 +0,0 @@
completion_dot_syntax_main.nim
> idetools --track:$TESTNIM,24,15 --def
def\tskProc\t$MODULE.echoRemainingDollars
> idetools --trackDirty:completion_dot_syntax_dirty.nim,$TESTNIM,25,12 --suggest
sug\tskProc\techoRemainingDollars
# The suggestion should not mention the other echoRemaining* variants.
!echoRemainingEuros
!echoRemainingBugs

View File

@@ -1,25 +0,0 @@
import strutils
# Verifies if the --suggestion switch differentiates types for dot notation.
type
TDollar = distinct int
TEuro = distinct int
proc echoRemainingDollars(amount: TDollar) =
echo "You have $1 dollars" % [$int(amount)]
proc echoRemainingEuros(amount: TEuro) =
echo "You have $1 euros" % [$int(amount)]
proc echoRemainingBugs() =
echo "You still have bugs"
proc main =
var
d: TDollar
e: TEuro
d = TDollar(23)
e = TEuro(32)
d.echoRemainingDollars()
e.echoRemai

View File

@@ -1,24 +0,0 @@
import strutils
# Verifies if the --suggestion switch differentiates types for dot notation.
type
TDollar = distinct int
TEuro = distinct int
proc echoRemainingDollars(amount: TDollar) =
echo "You have $1 dollars" % [$int(amount)]
proc echoRemainingEuros(amount: TEuro) =
echo "You have $1 euros" % [$int(amount)]
proc echoRemainingBugs() =
echo "You still have bugs"
proc main =
var
d: TDollar
e: TEuro
d = TDollar(23)
e = TEuro(32)
d.echoRemainingDollars()

View File

@@ -1,12 +0,0 @@
main.nim
> idetools --track:$TESTNIM,5,18 --def --verbosity:0 --hints:on
strutils.toUpper
! SuccessX
> idetools --track:$TESTNIM,5,18 --def --verbosity:0 --hints:on
strutils.toUpper
! SuccessX
> c --verbosity:0 --hints:on
SuccessX

View File

@@ -1,8 +0,0 @@
main.nim
> idetools --track:$TESTNIM,5,18 --def --verbosity:0 --hints:on
strutils.toUpper
! SuccessX
> c --verbosity:0 --hints:on
SuccessX

View File

@@ -1,15 +0,0 @@
# This example shows that idetools returns an empty signature for a forward
# declared proc in proc/symproc runs, but correctly returns the full signature
# in caas mode.
proc echoHello(text: string)
proc testForward() =
echo "T"
echoHello("T")
proc echoHello(text: string) =
echo "Hello Mr." & text
when isMainModule:
testForward()

View File

@@ -1,9 +0,0 @@
forward_declarations.nim
> idetools --track:$TESTNIM,9,5 --def $SILENT
skProc
proc \(string\)
> idetools --track:$TESTNIM,5,9 --def $SILENT
skProc
proc \(string\)

View File

@@ -1,17 +0,0 @@
forward_declarations.nim
> c --verbosity:0 --hints:on
SuccessX
# None of the following return three instances of the echoHello proc, the first
# being the forward declaration, the second being the usage inside testForward,
# and the third being the actual implementation.
> idetools --track:$TESTNIM,5,5 --usages $SILENT
skProc.*\n.*skProc.*\n.*skProc
> idetools --track:$TESTNIM,9,5 --usages $SILENT
skProc.*\n.*skProc.*\n.*skProc
> idetools --track:$TESTNIM,11,5 --usages $SILENT
skProc.*\n.*skProc.*\n.*skProc

View File

@@ -1,84 +0,0 @@
import unicode, sequtils, macros, re
proc test_enums() =
var o: Tfile
if o.open("files " & "test.txt", fmWrite):
o.write("test")
o.close()
proc test_iterators(filename = "tests.nim") =
let
input = readFile(filename)
letters = toSeq(runes(string(input)))
for letter in letters: echo int(letter)
const SOME_SEQUENCE = @[1, 2]
type
bad_string = distinct string
TPerson = object of TObject
name*: bad_string
age: int
proc adder(a, b: int): int =
result = a + b
type
PExpr = ref object of TObject ## abstract base class for an expression
PLiteral = ref object of PExpr
x: int
PPlusExpr = ref object of PExpr
a, b: PExpr
# watch out: 'eval' relies on dynamic binding
method eval(e: PExpr): int =
# override this base method
quit "to override!"
method eval(e: PLiteral): int = e.x
method eval(e: PPlusExpr): int = eval(e.a) + eval(e.b)
proc newLit(x: int): PLiteral = PLiteral(x: x)
proc newPlus(a, b: PExpr): PPlusExpr = PPlusExpr(a: a, b: b)
echo eval(newPlus(newPlus(newLit(1), newLit(2)), newLit(4)))
proc findVowelPosition(text: string) =
var found = -1
block loops:
for i, letter in pairs(text):
for j in ['a', 'e', 'i', 'o', 'u']:
if letter == j:
found = i
break loops # leave both for-loops
echo found
findVowelPosition("Zerg") # should output 1, position of vowel.
macro expect*(exceptions: varargs[expr], body: stmt): stmt {.immediate.} =
## Expect docstrings
let exp = callsite()
template expectBody(errorTypes, lineInfoLit: expr,
body: stmt): NimNode {.dirty.} =
try:
body
assert false
except errorTypes:
nil
var body = exp[exp.len - 1]
var errorTypes = newNimNode(nnkBracket)
for i in countup(1, exp.len - 2):
errorTypes.add(exp[i])
result = getAst(expectBody(errorTypes, exp.lineinfo, body))
proc err =
raise newException(EArithmetic, "some exception")
proc testMacro() =
expect(EArithmetic):
err()
testMacro()
let notAModule = re"(\w+)=(.*)"

View File

@@ -1,59 +0,0 @@
idetools_api.nim
> c --verbosity:0 --hints:on
SuccessX
> idetools --track:$TESTNIM,4,11 --def $SILENT
def\tskType\tsystem.TFile\tTFile
> idetools --track:$TESTNIM,5,7 --def $SILENT
def\tskProc\tsystem.Open\tproc \(var TFile, string, TFileMode, int\): bool
> idetools --track:$TESTNIM,5,21 --def $SILENT
def\tskProc\tsystem.\&\tproc \(string, string\): string\{.noSideEffect.\}
> idetools --track:$TESTNIM,5,38 --def $SILENT
def\tskEnumField\tsystem.TFileMode.fmWrite\tTFileMode
> idetools --track:$TESTNIM,7,6 --def $SILENT
def\tskProc\tsystem.Close\tproc \(TFile\)
> idetools --track:$TESTNIM,12,23 --def $SILENT
def\tskIterator\tunicode.runes\titerator \(string\): TRune
> idetools --track:$TESTNIM,12,15 --def $SILENT
def\tskTemplate\tsequtils.toSeq\tproc \(expr\): expr
> idetools --track:$TESTNIM,15,7 --def $SILENT
# ProcRun mode will fail the next line, because the type is returned empty.
def\tskConst\t$MODULE.SOME_SEQUENCE\tseq\[int\]\t
> idetools --track:$TESTNIM,15,23 --def $SILENT
def\tskProc\tsystem.@\tproc \(array\[IDX, T\]\): seq\[T\]\{.noSideEffect.\}
> idetools --track:$TESTNIM,17,3 --def $SILENT
# ProcRun mode will fail the next line, because the type is returned empty.
def\tskType\t$MODULE.bad_string\tbad_string\t
> idetools --track:$TESTNIM,11,24 --def $SILENT
def\tskParam\t$MODULE.test_iterators.filename\tstring
> idetools --track:$TESTNIM,6,5 --def $SILENT
def\tskVar\t$MODULE.test_enums.o\tTFile
> idetools --track:$TESTNIM,12,34 --def $SILENT
def\tskLet\t$MODULE.test_iterators.input\tTaintedString
> idetools --track:$TESTNIM,13,35 --def $SILENT
def\tskForVar\t$MODULE.test_iterators.letter\tTRune
> idetools --track:$TESTNIM,23,3 --def $SILENT
def\tskResult\t$MODULE.adder.result\tint
> idetools --track:$TESTNIM,19,6 --def $SILENT
# ProcRun mode will fail the next line, because the type is returned empty.
def\tskField\t$MODULE.TPerson.name\tbad_string\t
> idetools --track:$TESTNIM,43,7 --def $SILENT
def\tskMethod\t$MODULE.eval\tproc \(PPlusExpr\): int\t
> idetools --track:$TESTNIM,47,8 --def $SILENT
def\tskLabel\t$MODULE.findVowelPosition.loops\t\t
# For some reason the use of the label with break displaces its position.
> idetools --track:$TESTNIM,52,16 --def $SILENT
def\tskLabel\t$MODULE.findVowelPosition.loops\t\t
# Displaced macro usage by one character.
> idetools --track:$TESTNIM,80,2 --def $SILENT
def\tskMacro\t$MODULE.expect\tproc \(varargs\[expr\], stmt\): stmt\t
# The syntax for extended raw string literals should not be returned as module
# but as the proc re() inside the re module.
> idetools --track:$TESTNIM,84,17 --def $SILENT
!def\tskModule

View File

@@ -1,3 +0,0 @@
proc `+++`*(a,b: string): string =
return a & " " & b

View File

@@ -1,17 +0,0 @@
import unicode, sequtils
proc test() =
let input = readFile("weird.nim")
for letter in runes(string(input)):
echo int(letter)
when 1 > 0:
proc failtest() =
let
input = readFile("weird.nim")
letters = toSeq(runes(string(input)))
for letter in letters:
echo int(letter)
when isMainModule:
test()

View File

@@ -1,14 +0,0 @@
issue_416_template_shift.nim
> c --verbosity:0 --hints:on
SuccessX
> idetools --track:$TESTNIM,12,28 --def $SILENT
def\tskType\tsystem.string\tstring
> idetools --track:$TESTNIM,12,35 --def $SILENT
def\tskLet\t$MODULE.failtest.input\tTaintedString
# The following fail because they seem shifted one column to the right.
> idetools --track:$TESTNIM,12,16 --def $SILENT
def\tskTemplate\tsequtils.toSeq\tproc \(expr\): expr
> idetools --track:$TESTNIM,12,22 --def $SILENT
def\tskIterator\tunicode.runes\titerator \(string\): TRune

View File

@@ -1,8 +0,0 @@
const
VERSION_STR1* = "0.5.0" ## Idetools shifts this one column.
VERSION_STR2 = "0.5.0" ## This one is ok.
VERSION_STR3* = "0.5.0" ## Bad.
VERSION_STR4 = "0.5.0" ## Ok.
proc forward1*(): string = result = ""
proc forward2(): string = result = ""

View File

@@ -1,11 +0,0 @@
issue_452_export_shift.nim
> c --verbosity:0 --hints:on
SuccessX
> idetools --track:$TESTNIM,2,2 --def $SILENT
def\tskConst\t$MODULE.VERSION_STR1\tstring
> idetools --track:$TESTNIM,3,2 --def $SILENT
def\tskConst\t$MODULE.VERSION_STR2\tstring
> idetools --track:$TESTNIM,7,5 --def $SILENT
def\tskProc\t$MODULE.forward1\tproc \(\): string\t
> idetools --track:$TESTNIM,8,5 --def $SILENT
def\tskProc\t$MODULE.forward2\tproc \(\): string\t

View File

@@ -1,19 +0,0 @@
type
TThing = object of TObject
TUnit = object of TThing
x: int
method collide(a, b: TThing) {.inline.} =
quit "to override!"
method collide(a: TThing, b: TUnit) {.inline.} =
echo "collide1"
method collide(a: TUnit, b: TThing) {.inline.} =
echo "collide2"
var
a, b: TUnit
when isMainModule:
collide(a, b) # output: 2

View File

@@ -1,5 +0,0 @@
issue_477_dynamic_dispatch.nim
> c --run
SuccessX
> idetools --track:issue_477_dynamic_dispatch.nim,19,5 --def $SILENT
def\tskMethod\tissue_477_dynamic_dispatch.collide\tproc \(TUnit, TThing\)\{.inline.\}

View File

@@ -1,29 +0,0 @@
import unicode, sequtils
# This example shows that idetools returns proc as signature for everything
# which can be called. While a clever person would use the second column to
# differentiate between procs, methods and others, why does the output contain
# incorrect information?
type
TThing = object of TObject
TUnit = object of TThing
x: int
method collide(a, b: TThing) {.inline.} =
quit "to override!"
method collide(a: TThing, b: TUnit) {.inline.} =
echo "1"
method collide(a: TUnit, b: TThing) {.inline.} =
echo "2"
var
a, b: TUnit
let
input = readFile("its_full_of_procs.nim")
letters = toSeq(runes(string(input)))
collide(a, b) # output: 2

View File

@@ -1,20 +0,0 @@
its_full_of_procs.nim
> idetools --track:$TESTNIM,26,15 --def $SILENT
skProc
proc \(
> idetools --track:$TESTNIM,27,21 --def $SILENT
skIterator
iterator \(
!proc \(
> idetools --track:$TESTNIM,29,0 --def $SILENT
skMethod
method \(
!proc \(
> idetools --track:$TESTNIM,27,15 --def $SILENT
skTemplate
template \(
!proc \(

View File

@@ -1,7 +0,0 @@
import imported, strutils
proc main =
var t1 = "text"
var t2 = t1.toUpper
echo(t1 +++ t2)

View File

@@ -1,14 +0,0 @@
import imported, strutils
type
TFoo = object
x: int
y: string
proc main =
var t1 = "text"
var t2 = t1.toUpper
var foo = TFoo(x: 10, y: "test")
foo.
echo(t1 +++ t2)

View File

@@ -1,13 +0,0 @@
main.nim
# This example shows how the suggest feature can be used on a partial file
# using the --trackDirty switch.
> idetools --trackDirty:main_dirty.nim,$TESTNIM,12,7 --suggest $SILENT
skField\tx
skField\ty
# Repeating the query in caas should work always and retrieve same output.
CaasRun > idetools --trackDirty:main_dirty.nim,$TESTNIM,12,7 --suggest $SILENT
CaasRun skField\tx
CaasRun skField\ty
> c --verbosity:0 --hints:on
SuccessX

View File

@@ -1,26 +0,0 @@
main_dirty.nim
# A variant of the suggest-compile.txt, instead of using a "base" correct
# source, this one uses the "broken" main_dirty.nim which won't compile. The
# test tries to stress idetools to still provide a valid answer if possible,
# and at least provide the same output with repeated queries rather than dying
# after the first compilation error.
# The first query should work and provide valid suggestions.
> idetools --track:$TESTNIM,12,6 --suggest $SILENT
skField\tx
skField\ty
# Repeating the query should work too.
> idetools --track:$TESTNIM,12,6 --suggest $SILENT
skField\tx
skField\ty
# Expect now a compilation failure.
> c
!SuccessX
invalid indentation
# Repeating suggestions *after broken compilation* should work too.
> idetools --track:$TESTNIM,12,6 --suggest $SILENT
skField\tx
skField\ty