enum record_type_name = "Some_type"; @recordType(record_type_name) static struct RegexDoc { string name; int x; @label("12") bool flag; mixin HiBONRecord!(q{ this(string name, int x, bool flag) { this.name=name; this.x=x; this.flag=flag; } }); } static struct NoRecordType { int x; mixin HiBONRecord; } const no_record_type_doc = NoRecordType.init.toDoc; const regex_doc = RegexDoc("text", 42, false); const doc = regex_doc.toDoc; { // Test hibon key name match assert(HiBONregex("name").match(doc)); assert(HiBONregex(regex(`\d+`)).match(doc)); assert(!HiBONregex("no match").match(doc)); assert(!HiBONregex(regex(`no match`)).match(doc)); } { // Test hibon record type match assert(HiBONregex(string.init, record_type_name).match(doc)); assert(!HiBONregex(string.init, "Not found").match(doc)); assert(HiBONregex(string.init, regex(`_\w+`)).match(doc)); assert(!HiBONregex(string.init, regex(`_\d+`)).match(doc)); assert(!HiBONregex(string.init, "!").match(doc)); assert(HiBONregex(string.init, "!").match(no_record_type_doc)); } { // Test hibon record type match assert(HiBONregex(string.init, string.init, Type.STRING).match(doc)); assert(!HiBONregex(string.init, string.init, Type.BINARY).match(doc)); assert(HiBONregex(string.init, string.init, [Type.BINARY, Type.STRING]).match(doc)); assert(!HiBONregex(string.init, string.init, [Type.BINARY, Type.BIGINT]).match(doc)); }