aggregate the tests in library-tests/XML into a single .ql file

This commit is contained in:
Erik Krogh Kristensen
2020-10-14 12:44:02 +02:00
parent 4f28b6ddd8
commit 69093629e9
18 changed files with 52 additions and 48 deletions

View File

@@ -1 +0,0 @@
| tst.xml:3:3:3:20 | foo=bar | tst.xml:3:3:3:37 | child | foo | bar |

View File

@@ -1,4 +0,0 @@
import javascript
from XMLAttribute attr
select attr, attr.getElement(), attr.getName(), attr.getValue()

View File

@@ -1 +0,0 @@
| tst.xml:4:3:4:21 | a comment | a comment |

View File

@@ -1,4 +0,0 @@
import javascript
from XMLComment c
select c, c.getText()

View File

@@ -1,2 +0,0 @@
| tst.xml:2:1:5:8 | root | root | tst.xml | 0 | tst.xml:0:0:0:0 | tst.xml |
| tst.xml:3:3:3:37 | child | child | root | 0 | tst.xml:0:0:0:0 | tst.xml |

View File

@@ -1,4 +0,0 @@
import javascript
from XMLElement elt
select elt, elt.getName(), elt.getParent(), elt.getIndex(), elt.getFile()

View File

@@ -1 +0,0 @@
| tst.xml:3:3:3:37 | child | tst.xml:3:3:3:20 | foo=bar |

View File

@@ -1,4 +0,0 @@
import javascript
from XMLElement e
select e, e.getAnAttribute()

View File

@@ -1 +0,0 @@
| tst.xml:0:0:0:0 | tst.xml |

View File

@@ -1,4 +0,0 @@
import javascript
from XMLFile f
select f

View File

@@ -1,5 +0,0 @@
| tst.xml:2:1:5:8 | root |
| tst.xml:3:3:3:20 | foo=bar |
| tst.xml:3:3:3:37 | child |
| tst.xml:3:20:3:29 | Some text |
| tst.xml:4:3:4:21 | a comment |

View File

@@ -1,4 +0,0 @@
import javascript
from XMLLocatable x
select x

View File

@@ -1,2 +0,0 @@
| root | 0 | tst.xml:3:3:3:37 | child |
| tst.xml | 0 | tst.xml:2:1:5:8 | root |

View File

@@ -1,4 +0,0 @@
import javascript
from XMLParent p, int i
select p, i, p.getChild(i)

View File

@@ -1,3 +0,0 @@
| child | Some text |
| root | |
| tst.xml | |

View File

@@ -1,4 +0,0 @@
import javascript
from XMLParent p
select p, p.getTextValue()

View File

@@ -0,0 +1,24 @@
xmlAttribute
| tst.xml:3:3:3:20 | foo=bar | tst.xml:3:3:3:37 | child | foo | bar |
xmlComment
| tst.xml:4:3:4:21 | a comment | a comment |
xmlElement_getAnAttribute
| tst.xml:3:3:3:37 | child | tst.xml:3:3:3:20 | foo=bar |
xmlElement
| tst.xml:2:1:5:8 | root | root | tst.xml | 0 | tst.xml:0:0:0:0 | tst.xml |
| tst.xml:3:3:3:37 | child | child | root | 0 | tst.xml:0:0:0:0 | tst.xml |
xmlFile
| tst.xml:0:0:0:0 | tst.xml |
xmlLocatable
| tst.xml:2:1:5:8 | root |
| tst.xml:3:3:3:20 | foo=bar |
| tst.xml:3:3:3:37 | child |
| tst.xml:3:20:3:29 | Some text |
| tst.xml:4:3:4:21 | a comment |
xmlParent_getChild
| root | 0 | tst.xml:3:3:3:37 | child |
| tst.xml | 0 | tst.xml:2:1:5:8 | root |
xmlParent_getTextValue
| child | Some text |
| root | |
| tst.xml | |

View File

@@ -0,0 +1,28 @@
import javascript
query predicate xmlAttribute(XMLAttribute attr, XMLElement element, string name, string value) {
attr.getElement() = element and
attr.getName() = name and
attr.getValue() = value
}
query predicate xmlComment(XMLComment c, string text) { text = c.getText() }
query predicate xmlElement_getAnAttribute(XMLElement e, XMLAttribute attr) {
attr = e.getAnAttribute()
}
query predicate xmlElement(XMLElement elt, string name, XMLParent parent, int index, XMLFile file) {
name = elt.getName() and
parent = elt.getParent() and
index = elt.getIndex() and
file = elt.getFile()
}
query predicate xmlFile(XMLFile f) { any() }
query predicate xmlLocatable(XMLLocatable x) { any() }
query predicate xmlParent_getChild(XMLParent p, int i, XMLElement child) { child = p.getChild(i) }
query predicate xmlParent_getTextValue(XMLParent p, string text) { p.getTextValue() = text }