diff options
author | Araq <rumpf_a@web.de> | 2014-01-13 02:10:03 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-01-13 02:10:03 +0100 |
commit | 20b5f31c03fb556ec0aa2428a40adbac004d8987 (patch) | |
tree | 58086941e7d6bb8f480ca1173a95722ada9435b2 /tests/ccgbugs | |
parent | 51ee524109cf7e3e86c676bc1676063a01bfd979 (diff) | |
download | Nim-20b5f31c03fb556ec0aa2428a40adbac004d8987.tar.gz |
new tester; all tests categorized
Diffstat (limited to 'tests/ccgbugs')
-rw-r--r-- | tests/ccgbugs/tccgen1.nim | 67 | ||||
-rw-r--r-- | tests/ccgbugs/tcgbug.nim | 23 | ||||
-rw-r--r-- | tests/ccgbugs/tcodegenbug1.nim | 67 |
3 files changed, 157 insertions, 0 deletions
diff --git a/tests/ccgbugs/tccgen1.nim b/tests/ccgbugs/tccgen1.nim new file mode 100644 index 000000000..137dd545d --- /dev/null +++ b/tests/ccgbugs/tccgen1.nim @@ -0,0 +1,67 @@ + + +type + Feature = tuple[name: string, version: string] + PDOMImplementation* = ref DOMImplementation + DOMImplementation = object + Features: seq[Feature] # Read-Only + + PNode* = ref Node + Node = object {.inheritable.} + attributes*: seq[PAttr] + childNodes*: seq[PNode] + FLocalName: string # Read-only + FNamespaceURI: string # Read-only + FNodeName: string # Read-only + nodeValue*: string + FNodeType: int # Read-only + FOwnerDocument: PDocument # Read-Only + FParentNode: PNode # Read-Only + prefix*: string # Setting this should change some values... TODO! + + PElement* = ref Element + Element = object of Node + FTagName: string # Read-only + + PCharacterData = ref CharacterData + CharacterData = object of Node + data*: string + + PDocument* = ref Document + Document = object of Node + FImplementation: PDOMImplementation # Read-only + FDocumentElement: PElement # Read-only + + PAttr* = ref Attr + Attr = object of Node + FName: string # Read-only + FSpecified: bool # Read-only + value*: string + FOwnerElement: PElement # Read-only + + PDocumentFragment* = ref DocumentFragment + DocumentFragment = object of Node + + PText* = ref Text + Text = object of CharacterData + + PComment* = ref comment + Comment = object of CharacterData + + PCDataSection* = ref CDataSection + CDataSection = object of Text + + PProcessingInstruction* = ref ProcessingInstruction + ProcessingInstruction = object of Node + data*: string + FTarget: string # Read-only + +proc `namespaceURI=`*(n: var PNode, value: string) = + n.FNamespaceURI = value + +proc main = + var n: PNode + new(n) + n.namespaceURI = "test" + +main() diff --git a/tests/ccgbugs/tcgbug.nim b/tests/ccgbugs/tcgbug.nim new file mode 100644 index 000000000..417b909ae --- /dev/null +++ b/tests/ccgbugs/tcgbug.nim @@ -0,0 +1,23 @@ +discard """ + file: "tcgbug.nim" + output: "success" +""" + +type + TObj = object + x, y: int + PObj = ref TObj + +proc p(a: PObj) = + a.x = 0 + +proc q(a: var PObj) = + a.p() + +var + a: PObj +new(a) +q(a) + +echo "success" + diff --git a/tests/ccgbugs/tcodegenbug1.nim b/tests/ccgbugs/tcodegenbug1.nim new file mode 100644 index 000000000..7d0fc4ad5 --- /dev/null +++ b/tests/ccgbugs/tcodegenbug1.nim @@ -0,0 +1,67 @@ +import os + +type + TStatusEnum* = enum + sUnknown = -1, sBuildFailure, sBuildInProgress, sBuildSuccess, + sTestFailure, sTestInProgress, sTestSuccess, # ORDER MATTERS! + sDocGenFailure, sDocGenInProgress, sDocGenSuccess, + sCSrcGenFailure, sCSrcGenInProgress, sCSrcGenSuccess + + TStatus* = object + status*: TStatusEnum + desc*: string + hash*: string + +proc initStatus*(): TStatus = + result.status = sUnknown + result.desc = "" + result.hash = "" + +proc isInProgress*(status: TStatusEnum): bool = + return status in {sBuildInProgress, sTestInProgress, sDocGenInProgress, + sCSrcGenInProgress} + +proc `$`*(status: TStatusEnum): string = + case status + of sBuildFailure: + return "build failure" + of sBuildInProgress: + return "build in progress" + of sBuildSuccess: + return "build finished" + of sTestFailure: + return "testing failure" + of sTestInProgress: + return "testing in progress" + of sTestSuccess: + return "testing finished" + of sDocGenFailure: + return "documentation generation failed" + of sDocGenInProgress: + return "generating documentation" + of sDocGenSuccess: + return "documentation generation succeeded" + of sCSrcGenFailure: + return "csource generation failed" + of sCSrcGenInProgress: + return "csource generation in progress" + of sCSrcGenSuccess: + return "csource generation succeeded" + of sUnknown: + return "unknown" + +proc makeCommitPath*(platform, hash: string): string = + return platform / "nimrod_" & hash.substr(0, 11) # 11 Chars. + +type + TFlag = enum + A, B, C, D + + TFlags = set[TFlag] + + TObj = object + x: int + flags: TFlags + +# have a proc taking TFlags as param and returning object having TFlags field +proc foo(flags: TFlags): TObj = nil |