MCPcopy Create free account
hub / github.com/breck7/scroll / examplesToTestBlocks

Method examplesToTestBlocks

external/.scrollLibs.js:19914–19927  ·  view source on GitHub ↗
(rootParser = this.compileAndReturnRootParser(), expectedErrorMessage = "")

Source from the content-addressed store, hash-verified

19912 }
19913 }
19914 examplesToTestBlocks(rootParser = this.compileAndReturnRootParser(), expectedErrorMessage = "") {
19915 const testBlocks = {}
19916 this.validConcreteAndAbstractParserDefinitions.forEach(def =>
19917 def.examples.forEach(example => {
19918 const id = def.id + example.content
19919 testBlocks[id] = equal => {
19920 const exampleProgram = new rootParser(example.subparticlesToString())
19921 const errors = exampleProgram.getAllErrors(example._getLineNumber() + 1)
19922 equal(errors.join("\n"), expectedErrorMessage, `Expected no errors in ${id}`)
19923 }
19924 })
19925 )
19926 return testBlocks
19927 }
19928 toReadMe() {
19929 const languageName = this.extensionName
19930 const rootParticleDef = this.rootParserDefinition

Callers

nothing calls this directly

Calls 6

forEachMethod · 0.80
subparticlesToStringMethod · 0.80
getAllErrorsMethod · 0.80
_getLineNumberMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected