Script-generated tests for Servo_* gecko bindings

This commit is contained in:
Rafael Gomes Dantas 2016-10-06 16:18:54 +01:00
parent 6bd898626f
commit 5be551e10e
2 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,37 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import re
LICENSE = """\
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* automatically generated by check_bindings.py. */
"""
BINDINGS_PATH = os.path.join("..", "gecko_bindings")
INPUT_FILE = os.path.join(BINDINGS_PATH, "bindings.rs")
OUTPUT_FILE = os.path.join(BINDINGS_PATH, "check_bindings.rs")
TEMPLATE = """\
[ Servo_{name}, bindings::Servo_{name} ];
"""
with open(INPUT_FILE, "r") as bindings, open(OUTPUT_FILE, "w+") as tests:
tests.write(LICENSE)
tests.write("fn assert_types() {\n")
pattern = re.compile("fn\s*Servo_([_a-zA-Z0-9]+)\s*\(")
for line in bindings:
match = pattern.search(line)
if match:
tests.write(TEMPLATE.format(name=match.group(1)))
tests.write("}\n")

View file

@ -0,0 +1,60 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* automatically generated by check_bindings.py. */
fn assert_types() {
[ Servo_Node_ClearNodeData, bindings::Servo_Node_ClearNodeData ];
[ Servo_StyleSheet_FromUTF8Bytes, bindings::Servo_StyleSheet_FromUTF8Bytes ];
[ Servo_StyleSheet_AddRef, bindings::Servo_StyleSheet_AddRef ];
[ Servo_StyleSheet_Release, bindings::Servo_StyleSheet_Release ];
[ Servo_StyleSheet_HasRules, bindings::Servo_StyleSheet_HasRules ];
[ Servo_StyleSet_Init, bindings::Servo_StyleSet_Init ];
[ Servo_StyleSet_Drop, bindings::Servo_StyleSet_Drop ];
[ Servo_StyleSet_AppendStyleSheet, bindings::Servo_StyleSet_AppendStyleSheet ];
[ Servo_StyleSet_PrependStyleSheet, bindings::Servo_StyleSet_PrependStyleSheet ];
[ Servo_StyleSet_RemoveStyleSheet, bindings::Servo_StyleSet_RemoveStyleSheet ];
[ Servo_StyleSet_InsertStyleSheetBefore, bindings::Servo_StyleSet_InsertStyleSheetBefore ];
[ Servo_ParseStyleAttribute, bindings::Servo_ParseStyleAttribute ];
[ Servo_DeclarationBlock_AddRef, bindings::Servo_DeclarationBlock_AddRef ];
[ Servo_DeclarationBlock_Release, bindings::Servo_DeclarationBlock_Release ];
[ Servo_DeclarationBlock_GetCache, bindings::Servo_DeclarationBlock_GetCache ];
[ Servo_DeclarationBlock_SetImmutable, bindings::Servo_DeclarationBlock_SetImmutable ];
[ Servo_DeclarationBlock_ClearCachePointer, bindings::Servo_DeclarationBlock_ClearCachePointer ];
[ Servo_CSSSupports, bindings::Servo_CSSSupports ];
[ Servo_ComputedValues_Get, bindings::Servo_ComputedValues_Get ];
[ Servo_ComputedValues_GetForAnonymousBox, bindings::Servo_ComputedValues_GetForAnonymousBox ];
[ Servo_ComputedValues_GetForPseudoElement, bindings::Servo_ComputedValues_GetForPseudoElement ];
[ Servo_ComputedValues_Inherit, bindings::Servo_ComputedValues_Inherit ];
[ Servo_ComputedValues_AddRef, bindings::Servo_ComputedValues_AddRef ];
[ Servo_ComputedValues_Release, bindings::Servo_ComputedValues_Release ];
[ Servo_Initialize, bindings::Servo_Initialize ];
[ Servo_Shutdown, bindings::Servo_Shutdown ];
[ Servo_ComputeRestyleHint, bindings::Servo_ComputeRestyleHint ];
[ Servo_RestyleSubtree, bindings::Servo_RestyleSubtree ];
[ Servo_GetStyleFont, bindings::Servo_GetStyleFont ];
[ Servo_GetStyleColor, bindings::Servo_GetStyleColor ];
[ Servo_GetStyleList, bindings::Servo_GetStyleList ];
[ Servo_GetStyleText, bindings::Servo_GetStyleText ];
[ Servo_GetStyleVisibility, bindings::Servo_GetStyleVisibility ];
[ Servo_GetStyleUserInterface, bindings::Servo_GetStyleUserInterface ];
[ Servo_GetStyleTableBorder, bindings::Servo_GetStyleTableBorder ];
[ Servo_GetStyleSVG, bindings::Servo_GetStyleSVG ];
[ Servo_GetStyleVariables, bindings::Servo_GetStyleVariables ];
[ Servo_GetStyleBackground, bindings::Servo_GetStyleBackground ];
[ Servo_GetStylePosition, bindings::Servo_GetStylePosition ];
[ Servo_GetStyleTextReset, bindings::Servo_GetStyleTextReset ];
[ Servo_GetStyleDisplay, bindings::Servo_GetStyleDisplay ];
[ Servo_GetStyleContent, bindings::Servo_GetStyleContent ];
[ Servo_GetStyleUIReset, bindings::Servo_GetStyleUIReset ];
[ Servo_GetStyleTable, bindings::Servo_GetStyleTable ];
[ Servo_GetStyleMargin, bindings::Servo_GetStyleMargin ];
[ Servo_GetStylePadding, bindings::Servo_GetStylePadding ];
[ Servo_GetStyleBorder, bindings::Servo_GetStyleBorder ];
[ Servo_GetStyleOutline, bindings::Servo_GetStyleOutline ];
[ Servo_GetStyleXUL, bindings::Servo_GetStyleXUL ];
[ Servo_GetStyleSVGReset, bindings::Servo_GetStyleSVGReset ];
[ Servo_GetStyleColumn, bindings::Servo_GetStyleColumn ];
[ Servo_GetStyleEffects, bindings::Servo_GetStyleEffects ];
}