Test an @instanceOf class of a relative module from other directories
Why
A type can name its class with a module path relative to its own file, @module("./shapes.js") @instanceOf("Circle"). An untagged variant switch in a module of another directory writes that path into its own import, where it names another file or none.
This commit only adds the project test, which fails on its first module of another directory: src/app/App.mjs imports ./shapes.js, not ../shapes/shapes.js. The next commit fixes the import.
addedJS class check in another directory
// src/shapes/Shapes.res@module("./shapes.js") @instanceOf("Circle")type circle // src/app/App.res@unboxedtype value = | Circle(Shapes.circle) | Plain({"plain": bool}) let kind = value => switch value { | Circle(_) => "circle" | Plain(_) => "plain" }
js
import * as ShapesJs from "./shapes.js"; function kind(value) { if (value instanceof ShapesJs.Circle) { return "circle"; } else { return "plain"; }}
text
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '…/src/app/shapes.js' imported from …/src/app/App.mjstext
AssertionError [ERR_ASSERTION]: imports of src/app/App.mjs actual: [ './shapes.js' ], expected: [ '../shapes/shapes.js' ],