-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TriggerableDagTest.java
- port relevance exclusion test…
- Test exercises what seems like various internals. Minimal effort has been made to satisfy those interfaces so they type check. - Test will fail before reaching those interfaces regardless. - Includes a supplemental test exercising some similar aspects of excluding non-relevant nodes - Supplemental test fails, caught a bug!
- Loading branch information
1 parent
32482ee
commit 64e6415
Showing
8 changed files
with
324 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { RootNode } from '@odk-web-forms/xforms-engine'; | ||
|
||
/** | ||
* @todo Hopefully we can keep this interface extremely minimal. It currently | ||
* exists only to allow tests calling into it to type check. | ||
*/ | ||
export class JRFormDef { | ||
constructor(readonly instanceRoot: RootNode) {} | ||
|
||
getMainInstance(): RootNode { | ||
return this.instanceRoot; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* This class is a stub, meant only to represent values of JavaRosa's | ||
* `EvaluationContext` type (named here with a `JR` prefix to disambiguate it | ||
* from a substantially different interface of the same name within | ||
* `@odk-web-forms/xpath-engine` internals). | ||
*/ | ||
export class JREvaluationContext { | ||
/** | ||
* This property only serves as a means to have TypeScript treat the class and | ||
* instances of it as a nominal type (i.e. so that it won't be confused with | ||
* an empty object type). | ||
*/ | ||
protected readonly IS_STUB_OF_JAVAROSA_EVALUATION_CONTEXT = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* @todo Hopefully we can keep this interface extremely minimal. It currently | ||
* exists only to allow tests calling into it to type check. | ||
*/ | ||
export class JRTreeReference { | ||
constructor(readonly xpathReference: string) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { JavaUtilList } from '../../java/util/List.ts'; | ||
import type { JRTreeReference } from './JRTreeReference.ts'; | ||
import type { XPathPathExprEval } from './XPathPathExprEval.ts'; | ||
|
||
/** | ||
* Not currently implemented. Types are provided to represent certain | ||
* implementation details exercised in tests ported from JavaRosa, with the | ||
* intent that those tests should pass a type check even where they'd otherwise | ||
* be skipped (or otherwise expected to fail for reasons not related to | ||
* implementation detail-specific assertions). | ||
* | ||
* This interface corresponds to JavaRosa's class named `XPathNodeset`, here | ||
* prefixed with `JR` to preemptively disambiguate any usage of the name in web | ||
* forms internals (for instance, within `@odk-web-forms/xpath`, where the name | ||
* could reasonably be expected to find use). | ||
* | ||
* @see {@link XPathPathExprEval} for additional details. | ||
*/ | ||
export interface JRXPathNodeset { | ||
getReferences(): JavaUtilList<JRTreeReference>; | ||
size(): number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { UnclearApplicabilityError } from '../../error/UnclearApplicabilityError.ts'; | ||
import type { JREvaluationContext } from './JREvaluationContext.ts'; | ||
import type { JRTreeReference } from './JRTreeReference.ts'; | ||
|
||
/** | ||
* @todo Hopefully we can keep this interface extremely minimal. It currently | ||
* exists only to allow tests calling into it to type check. | ||
*/ | ||
export class XPathPathExpr { | ||
static getRefValue(_model: unknown, _ec: JREvaluationContext, _ref: JRTreeReference): string { | ||
throw new UnclearApplicabilityError('exposure of XPath evaluation implementation details'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { UnclearApplicabilityError } from '../../error/UnclearApplicabilityError.ts'; | ||
import type { JREvaluationContext } from './JREvaluationContext.ts'; | ||
import type { JRTreeReference } from './JRTreeReference.ts'; | ||
import type { JRXPathNodeset } from './JRXPathNodeset.ts'; | ||
|
||
/** | ||
* **PORTING NOTES** | ||
* | ||
* This is currently a stub of the class and methods of the same name/shape in | ||
* —and as called within tests ported from—JavaRosa. The constructor will | ||
* produce a valid instance, but calls to any of its methods will throw a | ||
* runtime error. | ||
* | ||
* From a testing perspective, this class is understood to be used in assertions | ||
* about certain aspects of implementation detail, corresponding to concepts we | ||
* don't expose in the engine/client interface nor expect to expose in the | ||
* foreseeable future. | ||
* | ||
* Where possible, ported tests which depend on instances of this class will be | ||
* accompanied by a supplemental test addressing aspects of those tests which | ||
* are clearly transferrable to more pertinent client-facing APIs. | ||
*/ | ||
export class XPathPathExprEval { | ||
eval(_treeReference: JRTreeReference, _evaluationContext: JREvaluationContext): JRXPathNodeset { | ||
throw new UnclearApplicabilityError('exposure of XPath evaluation implementation details'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters