Add tests for special link fields too

This commit is contained in:
Andrew Johnson
2021-05-06 18:20:59 -05:00
parent b42a145824
commit 6c7214ee06
3 changed files with 14 additions and 2 deletions

View File

@@ -317,17 +317,27 @@ static
void testPutSpecial(void)
{
const char val[] = "special";
const char inp[] = "special.INP";
const char sfx[] = "special.SFX";
testDiag("testPutSpecial()");
/* There are separate sets of calls to dbPutSpecial() in
* dbPut() and in dbPutFieldLink() so we need to check
* both regular fields and link fields.
*/
testdbPutFieldOk(val, DBR_LONG, 1);
testdbPutFieldOk(inp, DBR_STRING, "1.0");
testdbPutFieldOk(sfx, DBR_LONG, SFX_Before); /* Reject early */
testdbPutFieldFail(S_db_Blocked, val, DBR_LONG, 2);
testdbGetFieldEqual(val, DBR_LONG, 1); /* Wasn't modified */
testdbPutFieldFail(S_db_Blocked, inp, DBR_STRING, "2.0");
testdbGetFieldEqual(inp, DBR_STRING, "1.0"); /* Wasn't modified */
testdbPutFieldOk(sfx, DBR_LONG, SFX_After); /* Reject late */
testdbPutFieldFail(S_db_Blocked, val, DBR_LONG, 3);
testdbPutFieldFail(S_db_Blocked, inp, DBR_STRING, "3.0");
testdbPutFieldOk(sfx, DBR_LONG, SFX_None);
testdbPutFieldOk(val, DBR_LONG, 4);
testdbPutFieldOk(inp, DBR_STRING, "4.0");
}
@@ -335,7 +345,7 @@ void dbTestIoc_registerRecordDeviceDriver(struct dbBase *);
MAIN(dbPutGet)
{
testPlan(119);
testPlan(124);
testdbPrepare();
testdbMetaDoubleSizes();

View File

@@ -79,7 +79,8 @@ static long process(struct dbCommon *pcommon)
static long special(struct dbAddr *paddr, int after)
{
struct xRecord *prec = (struct xRecord *) paddr->precord;
if (dbGetFieldIndex(paddr) != xRecordVAL) {
if (dbGetFieldIndex(paddr) != xRecordVAL &&
dbGetFieldIndex(paddr) != xRecordINP) {
recGblRecordError(S_db_badField, prec, "x: special");
return S_db_badField;
}

View File

@@ -47,6 +47,7 @@ recordtype(x) {
}
field(INP, DBF_INLINK) {
prompt("Input Link")
special(SPC_MOD)
}
field(CLBK, DBF_NOACCESS) {
prompt("Processing callback")