package org.eclipse.dltk.tcl.parser.tests; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import java.util.List; import org.eclipse.dltk.tcl.ast.TclCommand; import org.eclipse.dltk.tcl.parser.ITclParserOptions; import org.eclipse.dltk.tcl.parser.TclErrorCollector; import org.eclipse.dltk.tcl.parser.TclParser; import org.eclipse.dltk.tcl.parser.definitions.DefinitionManager; import org.eclipse.dltk.tcl.parser.definitions.NamespaceScopeProcessor; import org.eclipse.dltk.tcl.parser.definitions.SynopsisBuilder; import org.junit.Test; public class SynopsisTests { NamespaceScopeProcessor processor; @Test public void test001() { String source = "after"; String synopsis = "after ms ?script ...?\n" + "after cancel id\n" + "after cancel script ?script ...?\n" + "after idle script ?script ...?\n" + "after info ?id?"; typedCheck(source, synopsis, "8.5"); } @Test public void test002() { String source = "append"; String synopsis = "append varName ?value ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test003() { String source = "apply"; String synopsis = "apply {args body ?namespace?} ?arg ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test004() { String source = "array"; String synopsis = "array anymore arrayName searchId\n" + "array donesearch arrayName searchId\n" + "array exists arrayName\n" + "array get arrayName ?pattern?\n" + "array names arrayName ?[-exact|-glob|-regexp]? ?pattern?\n" // mode + "array nextelement arrayName searchId\n" + "array set arrayName {?key value ...?}\n" + "array size arrayName\n" + "array startsearch arrayName\n" + "array statistics arrayName\n" + "array unset arrayName ?pattern?"; typedCheck(source, synopsis, "8.5"); } @Test public void test005() { String source = "auto_execok"; String synopsis = "auto_execok cmd"; typedCheck(source, synopsis, "8.5"); } @Test public void test006() { String source = "auto_import"; String synopsis = "auto_import pattern"; typedCheck(source, synopsis, "8.5"); } @Test public void test007() { String source = "auto_load"; String synopsis = "auto_load cmd ?namespace?"; typedCheck(source, synopsis, "8.5"); } @Test public void test008() { String source = "auto_mkindex"; String synopsis = "auto_mkindex dir pattern ?pattern ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test009() { String source = "auto_mkindex_old"; String synopsis = "auto_mkindex_old dir pattern ?pattern ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test010() { String source = "auto_qualify"; String synopsis = "auto_qualify command namespace"; typedCheck(source, synopsis, "8.5"); } @Test public void test011() { String source = "auto_reset"; String synopsis = "auto_reset"; typedCheck(source, synopsis, "8.5"); } @Test public void test012() { String source = "binary"; String synopsis = "binary format formatString ?arg ...?\n" + "binary scan string formatString ?varName ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test013() { String source = "break"; String synopsis = "break"; typedCheck(source, synopsis, "8.5"); } @Test public void test014() { String source = "catch"; String synopsis = "catch script ?resultVarName? ?optionsVarName?"; String synopsis_8_4 = "catch script ?resultVarName?"; typedCheck(source, synopsis, "8.5"); typedCheck(source, synopsis_8_4, "8.4"); } @Test public void test015() { String source = "cd"; String synopsis = "cd ?dirName?"; typedCheck(source, synopsis, "8.5"); } @Test public void test016() { String source = "chan"; String synopsis = "chan blocked channelId\n" + "chan close channelId\n" + "chan configure channelId ?option? ?value? ?option value ...?\n" + "chan copy inputChan outputChan ?-size size? ?-command callback?\n" + "chan create mode cmdPrefix\n" + "chan eof channelId\n" + "chan event channelId event ?script?\n" + "chan flush channelId\n" + "chan gets channelId ?varName?\n" + "chan names ?pattern?\n" + "chan pending mode channelId\n" + "chan postevent channelId eventSpec\n" + "chan puts ?-nonewline? ?channelId? string\n" + "chan read channelId ?numChars?\n" + "chan read ?-nonewline? channelId\n" + "chan seek channelId offset ?origin?\n" // origin + "chan tell channelId\n" + "chan truncate channelId ?length?"; typedCheck(source, synopsis, "8.5"); } @Test public void test017() { String source = "clock"; String synopsis_8_4 = "clock clicks ?-milliseconds?\n" + "clock format clockValue ?option value ...?\n" + "clock scan dateString ?option value ...?\n" + "clock seconds"; String synopsis = "clock add timeVal ?count unit ...? ?option value ...?\n" + "clock clicks ?option?\n" + "clock format timeVal ?option value ...?\n" + "clock microseconds\n" + "clock milliseconds\n" + "clock scan inputString ?option value ...?\n" + "clock seconds"; typedCheck(source, synopsis_8_4, "8.4"); typedCheck(source, synopsis, "8.5"); } @Test public void test018() { String source = "close"; String synopsis = "close channelId"; typedCheck(source, synopsis, "8.5"); } @Test public void test019() { String source = "concat"; String synopsis = "concat ?arg ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test020() { String source = "continue"; String synopsis = "continue"; typedCheck(source, synopsis, "8.5"); } @Test public void test021() { String source = "dde"; String synopsis_8_4 = "dde servername ?topic?\n" + "dde execute ?-async? service topic data\n" + "dde poke service topic item data\n" + "dde request ?-binary? service topic item\n" + "dde services service topic\n" + "dde eval ?-async? topic cmd ?arg ...?"; String synopsis = "dde servername ?-force? ?-handler proc? ?--? ?topic?\n" + "dde execute ?-async? service topic data\n" + "dde poke service topic item data\n" + "dde request ?-binary? service topic item\n" + "dde services service topic\n" + "dde eval ?-async? topic cmd ?arg ...?"; typedCheck(source, synopsis_8_4, "8.4"); typedCheck(source, synopsis, "8.5"); } @Test public void test022() { String source = "dict"; String synopsis = "dict append dictionaryVariable key ?string ...?\n" + "dict create ?key value ...?\n" + "dict exists dictionaryValue key ?key ...?\n" + "dict filter dictionaryValue key globPattern\n" + "dict filter dictionaryValue script {keyVar valueVar} body\n" + "dict filter dictionaryValue value globPattern\n" + "dict for {keyVar valueVar} dictionaryValue body\n" + "dict get dictionaryValue ?key ...?\n" + "dict incr dictionaryVariable key ?increment?\n" + "dict info dictionaryValue\n" + "dict keys dictionaryValue ?globPattern?\n" + "dict lappend dictionaryVariable key ?value ...?\n" + "dict merge ?dictionaryValue ...?\n" + "dict remove dictionaryValue ?key ...?\n" + "dict replace dictionaryValue ?key value ...?\n" + "dict set dictionaryVariable key ?key ...? value\n" + "dict size dictionaryValue\n" + "dict unset dictionaryVariable key ?key ...?\n" + "dict update dictionaryVariable key varName ?key varName ...? body\n" + "dict values dictionaryValue ?globPattern?\n" + "dict with dictionaryVariable ?key ...? body"; typedCheck(source, synopsis, "8.5"); } @Test public void test023() { String source = "encoding"; String synopsis_8_4 = "encoding convertfrom ?encoding? data\n" + "encoding convertto ?encoding? string\n" + "encoding names\n" + "encoding system ?encoding?"; String synopsis = "encoding convertfrom ?encoding? data\n" + "encoding convertto ?encoding? string\n" + "encoding dirs ?directoryList?\n" + "encoding names\n" + "encoding system ?encoding?"; typedCheck(source, synopsis_8_4, "8.4"); typedCheck(source, synopsis, "8.5"); } @Test public void test024() { String source = "eof"; String synopsis = "eof channelId"; typedCheck(source, synopsis, "8.5"); } @Test public void test025() { String source = "error"; String synopsis = "error message ?info? ?code?"; typedCheck(source, synopsis, "8.5"); } @Test public void test026() { String source = "eval"; String synopsis = "eval arg ?arg ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test027() { String source = "exec"; String synopsis_8_4 = "exec ?-keepnewline? ?--? arg ?arg ...?"; String synopsis = "exec ?-ignorestderr? ?-keepnewline? ?--? arg ?arg ...?"; typedCheck(source, synopsis_8_4, "8.4"); typedCheck(source, synopsis, "8.5"); } @Test public void test028() { String source = "exit"; String synopsis = "exit ?returnCode?"; typedCheck(source, synopsis, "8.5"); } @Test public void test029() { String source = "expr"; String synopsis = "expr arg ?arg ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test030() { String source = "fblocked"; String synopsis = "fblocked channelId"; typedCheck(source, synopsis, "8.5"); } @Test public void test031() { String source = "fconfigure"; String synopsis = "fconfigure channelId ?name? ?value? ?name value ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test032() { String source = "fcopy"; String synopsis = "fcopy inchan outchan ?-size size? ?-command callback?"; typedCheck(source, synopsis, "8.5"); } @Test public void test033() { String source = "file"; String synopsis = "file atime name ?time?\n" + "file attributes name ?option? ?value? ?option value ...?\n" + "file channels ?pattern?\n" + "file copy ?-force? ?--? source target\n" + "file copy ?-force? ?--? source ?source ...? targetDir\n" + "file delete ?-force? ?--? pathname ?pathname ...?\n" + "file dirname name\n" + "file executable name\n" + "file exists name\n" + "file extension name\n" + "file isdirectory name\n" + "file isfile name\n" + "file join name ?name ...?\n" + "file link ?-linktype? linkName ?target?\n" + "file lstat name varName\n" + "file mkdir dir ?dir ...?\n" + "file mtime name ?time?\n" + "file nativename name\n" + "file normalize name\n" + "file owned name\n" + "file pathtype name\n" + "file readable name\n" + "file readlink name\n" + "file rename ?-force? ?--? source target\n" + "file rename ?-force? ?--? source ?source ...? targetDir\n" + "file rootname name\n" + "file separator ?name?\n" + "file size name\n" + "file split name\n" + "file stat name varName\n" + "file system name\n" + "file tail name\n" + "file type name\n" + "file volumes\n" + "file writable name"; typedCheck(source, synopsis, "8.5"); } @Test public void test034() { String source = "fileevent"; String synopsis = "fileevent channelId readable ?script?\n" + "fileevent channelId writable ?script?"; typedCheck(source, synopsis, "8.5"); } @Test public void test035() { String source = "flush"; String synopsis = "flush channelId"; typedCheck(source, synopsis, "8.5"); } @Test public void test036() { String source = "for"; String synopsis = "for start test next body"; typedCheck(source, synopsis, "8.5"); } @Test public void test037() { String source = "foreach"; String synopsis = "foreach varname list ?varname list ...? body"; typedCheck(source, synopsis, "8.5"); } @Test public void test038() { String source = "format"; String synopsis = "format formatString ?arg ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test039() { String source = "gets"; String synopsis = "gets channelId ?varName?"; typedCheck(source, synopsis, "8.5"); } @Test public void test040() { String source = "glob"; String synopsis = "glob ?switches ...? ?--? pattern ?pattern ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test041() { String source = "global"; String synopsis = "global varname ?varname ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test042() { String source = "history"; String synopsis = "history\n" + "history add command ?exec?\n" + "history change newValue ?event?\n" + "history clear\n" + "history event ?event?\n" + "history info ?count?\n" + "history keep ?count?\n" + "history nextid\n" + "history redo ?event?"; typedCheck(source, synopsis, "8.5"); } @Test public void test043() { String source = "::http::config"; String synopsis = "config ?option? ?value? ?option value ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test044() { String source = "::http::geturl"; String synopsis = "geturl url ?option? ?value? ?option value ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test045() { String source = "::http::formatQuery"; String synopsis = "formatQuery key value ?key value ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test046() { String source = "::http::reset"; String synopsis = "reset token ?why?"; typedCheck(source, synopsis, "8.5"); } @Test public void test047() { String source = "::http::wait"; String synopsis = "wait token"; typedCheck(source, synopsis, "8.5"); } @Test public void test048() { String source = "::http::status"; String synopsis = "status token"; typedCheck(source, synopsis, "8.5"); } @Test public void test049() { String source = "::http::size"; String synopsis = "size token"; typedCheck(source, synopsis, "8.5"); } @Test public void test050() { String source = "::http::code"; String synopsis = "code token"; typedCheck(source, synopsis, "8.5"); } @Test public void test051() { String source = "::http::ncode"; String synopsis = "ncode token"; typedCheck(source, synopsis, "8.5"); } @Test public void test052() { String source = "::http::meta"; String synopsis = "meta token"; typedCheck(source, synopsis, "8.5"); } @Test public void test053() { String source = "::http::data"; String synopsis = "data token"; typedCheck(source, synopsis, "8.5"); } @Test public void test054() { String source = "::http::error"; String synopsis = "error token"; typedCheck(source, synopsis, "8.5"); } @Test public void test055() { String source = "::http::cleanup"; String synopsis = "cleanup token"; typedCheck(source, synopsis, "8.5"); } @Test public void test056() { String source = "::http::register"; String synopsis = "register proto port command"; typedCheck(source, synopsis, "8.5"); } @Test public void test057() { String source = "::http::unregister"; String synopsis = "unregister proto"; typedCheck(source, synopsis, "8.5"); } @Test public void test058() { String source = "if"; String synopsis = "if expr1 ?then? body1 " + "?elseif expr2 ?then? body2 ...? ?else? ?bodyN?"; typedCheck(source, synopsis, "8.5"); } @Test public void test059() { String source = "incr"; String synopsis = "incr varName ?increment?"; typedCheck(source, synopsis, "8.5"); } @Test public void test060() { String source = "info"; String synopsis_8_4 = "info args procname\n" + "info body procname\n" + "info cmdcount\n" + "info commands ?pattern?\n" + "info complete command\n" + "info default procname arg varName\n" + "info exists varName\n" + "info functions ?pattern?\n" + "info globals ?pattern?\n" + "info hostname\n" + "info level ?number?\n" + "info library\n" + "info loaded ?interp?\n" + "info locals ?pattern?\n" + "info nameofexecutable\n" + "info patchlevel\n" + "info procs ?pattern?\n" + "info script ?filename?\n" + "info sharedlibextension\n" + "info tclversion\n" + "info vars ?pattern?"; String synopsis = "info args procname\n" + "info body procname\n" + "info cmdcount\n" + "info commands ?pattern?\n" + "info complete command\n" + "info default procname arg varName\n" + "info exists varName\n" + "info frame ?number?\n" + "info functions ?pattern?\n" + "info globals ?pattern?\n" + "info hostname\n" + "info level ?number?\n" + "info library\n" + "info loaded ?interp?\n" + "info locals ?pattern?\n" + "info nameofexecutable\n" + "info patchlevel\n" + "info procs ?pattern?\n" + "info script ?filename?\n" + "info sharedlibextension\n" + "info tclversion\n" + "info vars ?pattern?"; typedCheck(source, synopsis_8_4, "8.4"); typedCheck(source, synopsis, "8.5"); } @Test public void test061() { String source = "interp"; String synopsis = "interp alias srcPath srcToken\n" + "interp alias srcPath srcToken {}\n" + "interp alias srcPath srcCmd targetPath targetCmd ?arg ...?\n" + "interp aliases ?path?\n" + "interp bgerror path ?cmdPrefix?\n" + "interp create ?-safe? ?--? ?path?\n" + "interp delete ?path ...?\n" + "interp eval path arg ?arg ...?\n" + "interp exists path\n" + "interp expose path hiddenName ?exposedCmdName?\n" + "interp hide path exposedCmdName ?hiddenCmdName?\n" + "interp hidden path\n" + "interp invokehidden path ?-namespace? ?-global? ?--? hiddenCmdName ?arg ...?\n" + "interp limit path limitType ?option? ?value ...?\n" + "interp issafe ?path?\n" + "interp marktrusted path\n" + "interp recursionlimit path ?newlimit?\n" + "interp share srcPath channelId destPath\n" + "interp slaves ?path?\n" + "interp target path alias\n" + "interp transfer srcPath channelId destPath"; typedCheck(source, synopsis, "8.5"); } @Test public void test062() { String source = "join"; String synopsis = "join list ?joinString?"; typedCheck(source, synopsis, "8.5"); } @Test public void test063() { String source = "lappend"; String synopsis = "lappend varName ?value ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test064() { String source = "lassign"; String synopsis = "lassign list varName ?varName ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test065() { String source = "lindex"; String synopsis = "lindex list ?index ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test066() { String source = "linsert"; String synopsis = "linsert list index element ?element ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test067() { String source = "list"; String synopsis = "list ?arg ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test068() { String source = "llength"; String synopsis = "llength list"; typedCheck(source, synopsis, "8.5"); } @Test public void test069() { String source = "load"; String synopsis = "load fileName ?packageName? ?interp?"; typedCheck(source, synopsis, "8.5"); } @Test public void test070() { String source = "lrange"; String synopsis = "lrange list first last"; typedCheck(source, synopsis, "8.5"); } @Test public void test071() { String source = "lrepeat"; String synopsis = "lrepeat number element ?element ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test072() { String source = "lreplace"; String synopsis = "lreplace list first last ?element ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test073() { String source = "lreverse list"; String synopsis = "lreverse list"; typedCheck(source, synopsis, "8.5"); } @Test public void test074() { String source = "lsearch"; String synopsis = "lsearch ?options ...? list pattern"; typedCheck(source, synopsis, "8.5"); } @Test public void test075() { String source = "lset"; String synopsis = "lset varName ?index ...? newValue"; typedCheck(source, synopsis, "8.5"); } @Test public void test076() { String source = "lsort"; String synopsis = "lsort ?options ...? list"; typedCheck(source, synopsis, "8.4"); typedCheck(source, synopsis, "8.5"); } @Test public void test077() { String source = "memory"; String synopsis = "memory active file\n" + "memory break_on_malloc count\n" + "memory info\n" + "memory init [on|off]\n" + "memory onexit file\n" + "memory tag string\n" + "memory trace [on|off]\n" + "memory trace_on_at_malloc count\n" + "memory validate [on|off]"; typedCheck(source, synopsis, "8.5"); } @Test public void test078() { String source = "::msgcat::mc"; String synopsis = "mc src-string ?arg ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test079() { String source = "::msgcat::mcmax"; String synopsis = "mcmax ?src-string ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test080() { String source = "::msgcat::mclocale ?newLocale?"; String synopsis = "mclocale ?newLocale?"; typedCheck(source, synopsis, "8.5"); } @Test public void test081() { String source = "::msgcat::mcpreferences"; String synopsis = "mcpreferences"; typedCheck(source, synopsis, "8.5"); } @Test public void test082() { String source = "::msgcat::mcload"; String synopsis = "mcload dirname"; typedCheck(source, synopsis, "8.5"); } @Test public void test083() { String source = "::msgcat::mcset"; String synopsis = "mcset locale src-string ?translate-string?"; typedCheck(source, synopsis, "8.5"); } @Test public void test084() { String source = "::msgcat::mcmset"; String synopsis = "mcmset locale src-trans-list"; typedCheck(source, synopsis, "8.5"); } @Test public void test085() { String source = "::msgcat::mcunknown"; String synopsis = "mcunknown locale src-string"; typedCheck(source, synopsis, "8.5"); } @Test public void test086() { String source = "namespace"; String synopsis_8_4 = "namespace children ?namespace? ?pattern?\n" + "namespace code script\n" + "namespace current\n" + "namespace delete ?namespace ...?\n" + "namespace eval namespace arg ?arg ...?\n" + "namespace exists namespace\n" + "namespace export ?-clear? ?pattern ...?\n" + "namespace forget ?pattern ...?\n" + "namespace import ?-force? ?pattern ...?\n" + "namespace inscope namespace script ?arg ...?\n" + "namespace origin command\n" + "namespace parent ?namespace?\n" + "namespace qualifiers string\n" + "namespace tail string\n" + "namespace which ?-command? ?-variable? name"; String synopsis = "namespace children ?namespace? ?pattern?\n" + "namespace code script\n" + "namespace current\n" + "namespace delete ?namespace ...?\n" + "namespace ensemble subcommand ?arg ...?\n" + "namespace eval namespace arg ?arg ...?\n" + "namespace exists namespace\n" + "namespace export ?-clear? ?pattern ...?\n" + "namespace forget ?pattern ...?\n" + "namespace import ?-force? ?pattern ...?\n" + "namespace inscope namespace script ?arg ...?\n" + "namespace origin command\n" + "namespace parent ?namespace?\n" + "namespace path ?namespaceList?\n" + "namespace qualifiers string\n" + "namespace tail string\n" + "namespace upvar namespace otherVar myVar ?otherVar myVar ...?\n" + "namespace unknown ?script?\n" + "namespace which ?-command? ?-variable? name"; typedCheck(source, synopsis_8_4, "8.4"); typedCheck(source, synopsis, "8.5"); } @Test public void test087() { String source = "open"; String synopsis = "open fileName ?access? ?permissions?"; typedCheck(source, synopsis, "8.5"); } @Test public void test088() { String source = "package"; String synopsis_8_4 = "package forget ?package ...?\n" + "package ifneeded package version ?script?\n" + "package names\n" + "package present package ?requirement ...?\n" + "package present -exact package ?version?\n" + "package provide package ?version?\n" + "package require package ?requirement ...?\n" + "package require -exact package ?version?\n" + "package unknown ?command?\n" + "package vcompare version1 version2\n" + "package versions package\n" + "package vsatisfies version1 version2"; String synopsis = "package forget ?package ...?\n" + "package ifneeded package version ?script?\n" + "package names\n" + "package present package ?requirement ...?\n" + "package present -exact package ?version?\n" + "package provide package ?version?\n" + "package require package ?requirement ...?\n" + "package require -exact package ?version?\n" + "package unknown ?command?\n" + "package vcompare version1 version2\n" + "package versions package\n" + "package vsatisfies version requirement ?requirement ...?\n" + "package prefer ?[latest|stable]?"; typedCheck(source, synopsis_8_4, "8.4"); typedCheck(source, synopsis, "8.5"); } @Test public void test089() { String source = "parray"; String synopsis = "parray arrayName"; typedCheck(source, synopsis, "8.5"); } @Test public void test090() { String source = "pid"; String synopsis = "pid ?fileId?"; typedCheck(source, synopsis, "8.5"); } @Test public void test091() { String source = "::pkg::create"; String synopsis = "create -name packageName -version " + "packageVersion ?-load filespec? ?-source filespec?"; typedCheck(source, synopsis, "8.5"); } @Test public void test092() { String source = "pkg_mkIndex"; String synopsis = "pkg_mkIndex ?options ...? ?--? dir ?pattern ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test093() { String source = "platform::generic"; String synopsis = "generic"; typedCheck(source, synopsis, "8.5"); } @Test public void test094() { String source = "platform::identify"; String synopsis = "identify"; typedCheck(source, synopsis, "8.5"); } @Test public void test095() { String source = "platform::patterns"; String synopsis = "patterns identifier"; typedCheck(source, synopsis, "8.5"); } @Test public void test096() { String source = "platform::shell::generic"; String synopsis = "generic shell"; typedCheck(source, synopsis, "8.5"); } @Test public void test097() { String source = "platform::shell::identify"; String synopsis = "identify shell"; typedCheck(source, synopsis, "8.5"); } @Test public void test098() { String source = "platform::shell::platform"; String synopsis = "platform shell"; typedCheck(source, synopsis, "8.5"); } @Test public void test099() { String source = "proc"; String synopsis = "proc name args body"; typedCheck(source, synopsis, "8.5"); } @Test public void test100() { String source = "puts"; String synopsis = "puts -nonewline ?channelId? string\nputs ?channelId? string ?nonewline?"; typedCheck(source, synopsis, "8.5"); } @Test public void test101() { String source = "pwd"; String synopsis = "pwd"; typedCheck(source, synopsis, "8.5"); } @Test public void test102() { String source = "read"; String synopsis = "read channelId ?numChars?\n" + "read -nonewline channelId"; typedCheck(source, synopsis, "8.5"); } @Test public void test103() { String source = "regexp"; String synopsis = "regexp ?options ...? ?--? exp string ?matchVar ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test104() { String source = "registry"; String synopsis = "registry broadcast keyName ?-timeout milliseconds?\n" + "registry delete keyName ?valueName?\n" + "registry get keyName valueName\n" + "registry keys keyName ?pattern?\n" + "registry set keyName ?valueName data ?type??\n" + "registry type keyName valueName\n" + "registry values keyName ?pattern?"; typedCheck(source, synopsis, "8.5"); } @Test public void test105() { String source = "regsub"; String synopsis = "regsub ?options ...? ?--? exp string subSpec ?varName?"; typedCheck(source, synopsis, "8.5"); } @Test public void test106() { String source = "rename"; String synopsis = "rename oldName newName"; typedCheck(source, synopsis, "8.5"); } @Test public void test107() { String source = "return"; String synopsis = "return ?option value ...? ?result?"; typedCheck(source, synopsis, "8.5"); } @Test public void test108() { String source = "::safe::interpCreate"; String synopsis = "interpCreate ?slave? ?options ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test109() { String source = "::safe::interpInit"; String synopsis = "interpInit slave ?options ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test110() { String source = "::safe::interpConfigure"; String synopsis = "interpConfigure slave ?options ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test111() { String source = "::safe::interpDelete"; String synopsis = "interpDelete slave"; typedCheck(source, synopsis, "8.5"); } @Test public void test112() { String source = "::safe::interpAddToAccessPath"; String synopsis = "interpAddToAccessPath slave directory"; typedCheck(source, synopsis, "8.5"); } @Test public void test113() { String source = "::safe::interpFindInAccessPath"; String synopsis = "interpFindInAccessPath slave directory"; typedCheck(source, synopsis, "8.5"); } @Test public void test114() { String source = "::safe::setLogCmd"; String synopsis = "setLogCmd ?cmd? ?arg ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test115() { String source = "scan"; String synopsis = "scan string format ?varName ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test116() { String source = "seek"; String synopsis = "seek channelId offset ?[start|current|end]?";// origin typedCheck(source, synopsis, "8.5"); } @Test public void test117() { String source = "set"; String synopsis = "set varName ?value?"; typedCheck(source, synopsis, "8.5"); } @Test public void test118() { String source = "socket"; String synopsis = "socket -server command ?-myaddr addr? port\n" + "socket ?-myaddr addr? ?-myport port? ?-async? host port"; typedCheck(source, synopsis, "8.5"); } @Test public void test119() { String source = "source"; String synopsis = "source ?-encoding encodingName? fileName"; typedCheck(source, synopsis, "8.5"); } @Test public void test120() { String source = "split"; String synopsis = "split string ?splitChars?"; typedCheck(source, synopsis, "8.5"); } @Test public void test121() { String source = "string"; String synopsis_8_4 = "string bytelength string\n" + "string compare ?-nocase? ?-length int? string1 string2\n" + "string equal ?-nocase? ?-length int? string1 string2\n" + "string first string1 string2 ?startIndex?\n" + "string index string charIndex\n" + "string is class ?-strict? ?-failindex varName? string\n" + "string last string1 string2 ?lastIndex?\n" + "string length string\n" + "string map ?-nocase? mapping string\n" + "string match ?-nocase? pattern string\n" + "string range string first last\n" + "string repeat string count\n" + "string replace string first last ?newString?\n" + "string tolower string ?first? ?last?\n" + "string totitle string ?first? ?last?\n" + "string toupper string ?first? ?last?\n" + "string trim string ?chars?\n" + "string trimleft string ?chars?\n" + "string trimright string ?chars?\n" + "string wordend string charIndex\n" + "string wordstart string charIndex"; String synopsis = "string bytelength string\n" + "string compare ?-nocase? ?-length int? string1 string2\n" + "string equal ?-nocase? ?-length int? string1 string2\n" + "string first needleString haystackString ?startIndex?\n" + "string index string charIndex\n" + "string is class ?-strict? ?-failindex varName? string\n" + "string last needleString haystackString ?lastIndex?\n" + "string length string\n" + "string map ?-nocase? mapping string\n" + "string match ?-nocase? pattern string\n" + "string range string first last\n" + "string repeat string count\n" + "string replace string first last ?newString?\n" + "string reverse string\n" + "string tolower string ?first? ?last?\n" + "string totitle string ?first? ?last?\n" + "string toupper string ?first? ?last?\n" + "string trim string ?chars?\n" + "string trimleft string ?chars?\n" + "string trimright string ?chars?\n" + "string wordend string charIndex\n" + "string wordstart string charIndex"; typedCheck(source, synopsis_8_4, "8.4"); typedCheck(source, synopsis, "8.5"); } @Test public void test122() { String source = "subst"; String synopsis = "subst ?-nobackslashes? ?-nocommands? ?-novariables? string"; typedCheck(source, synopsis, "8.5"); } @Test public void test123() { String source = "switch"; String synopsis = "switch ?options ...? ?--? string pattern body ?pattern body ...?\n" + "switch ?options ...? ?--? string {pattern body ?pattern body ...?}"; typedCheck(source, synopsis, "8.5"); } @Test public void test124() { String source = "tcl_endOfWord"; String synopsis = "tcl_endOfWord str start"; typedCheck(source, synopsis, "8.5"); } @Test public void test125() { String source = "tcl_startOfNextWord"; String synopsis = "tcl_startOfNextWord str start"; typedCheck(source, synopsis, "8.5"); } @Test public void test126() { String source = "tcl_startOfPreviousWord"; String synopsis = "tcl_startOfPreviousWord str start"; typedCheck(source, synopsis, "8.5"); } @Test public void test127() { String source = "tcl_wordBreakAfter"; String synopsis = "tcl_wordBreakAfter str start"; typedCheck(source, synopsis, "8.5"); } @Test public void test128() { String source = "tcl_wordBreakBefore"; String synopsis = "tcl_wordBreakBefore str start"; typedCheck(source, synopsis, "8.5"); } @Test public void test129() { String source = "tell"; String synopsis = "tell channelId"; typedCheck(source, synopsis, "8.5"); } @Test public void test130() { String source = "time"; String synopsis = "time script ?count?"; typedCheck(source, synopsis, "8.5"); } @Test public void test131() { String source = "::tcl::tm::path"; String synopsis = "path add path ?path ...?\n" + "path remove path ?path ...?\n" + "path list"; typedCheck(source, synopsis, "8.5"); } @Test public void test132() { String source = "::tcl::tm::roots"; String synopsis = "roots path ?path ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test133() { String source = "trace"; String synopsis = "trace add command name ops commandPrefix\n" + "trace add execution name ops commandPrefix\n" + "trace add variable name ops commandPrefix\n" + "trace remove command name ops commandPrefix\n" + "trace remove execution name ops commandPrefix\n" + "trace remove variable name ops commandPrefix\n" + "trace info command name\n" + "trace info execution name\n" + "trace info variable name\n" + "trace variable name ops command\n" + "trace vdelete name ops command\n" + "trace vinfo name"; typedCheck(source, synopsis, "8.5"); } @Test public void test134() { String source = "unknown"; String synopsis = "unknown cmdName ?arg ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test135() { String source = "unload"; String synopsis = "unload ?-nocomplain? ?-keeplibrary? ?--? fileName ?packageName? ?interp?"; typedCheck(source, synopsis, "8.5"); } @Test public void test136() { String source = "unset"; String synopsis = "unset ?-nocomplain? ?--? ?name ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test137() { String source = "update"; String synopsis = "update ?idletasks?"; typedCheck(source, synopsis, "8.5"); } @Test public void test138() { String source = "uplevel"; String synopsis = "uplevel ?level? arg ?arg ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test139() { String source = "upvar"; String synopsis = "upvar ?level? otherVar myVar ?otherVar myVar ...?"; typedCheck(source, synopsis, "8.5"); } @Test public void test140() { String source = "variable"; String synopsis = "variable ?name value ...? name ?value?"; typedCheck(source, synopsis, "8.5"); } @Test public void test141() { String source = "vwait"; String synopsis = "vwait varName"; typedCheck(source, synopsis, "8.5"); } @Test public void test142() { String source = "while"; String synopsis = "while test body"; typedCheck(source, synopsis, "8.5"); } private void typedCheck(String source, String expected, String version) { processor = DefinitionManager.getInstance().createProcessor(); TclParser parser = TestUtils.createParser(version); TclErrorCollector errors = new TclErrorCollector(); parser.setOptionValue(ITclParserOptions.REPORT_UNKNOWN_AS_ERROR, true); List<TclCommand> module = parser.parse(source, errors, processor); assertEquals(1, module.size()); TclCommand command = module.get(0); SynopsisBuilder synopsis = new SynopsisBuilder(); String actual = synopsis.getSynopsis(command.getDefinition()); assertNotNull(actual); System.out.println( "===================" + version + "==================="); System.out.println(actual); System.out.println("-----------------------------------------"); System.out.println(expected); assertNotNull(expected); assertFalse(expected.equals("")); assertEquals(expected, actual); } }