<commit_before>
test proc-1 {
    set a 1
    proc foo {a b} {
	set a [+ $a 1]
	+ $a $b
    }
    set res "$a [foo $a 5]"
    set res
} {1 7}

test proc-2 {
    proc badcommand {a b} {}
    badcommand a b c d
} {{ERROR {proc badcommand has too many arguments}} {badcommand 3}}

test proc-3 {
    proc badcommand {a b} {}
    badcommand a
} {{ERROR {proc badcommand doesn't have enough arguments}} {badcommand 3}}

test proc-4 {
    proc f1 {} {return hello}
    proc f2 {} {return world}
    proc f3 {f} {$f}
    set res ""
    append $res [f3 f1]
    append $res [f3 f2]
    set res
} {helloworld}

test rename-1 {
    proc f1 {} {return fred}
    set r [f1]
    rename f1 newcmd
    append $r [newcmd]
    set r
} {fredfred}

test rename-2 {
    proc rn2 {} {return barney}
    set r [rn2]
    rename rn2 rn2new
    catch {
	append $r [rn2]
    } foo
    append $r [rn2new]
    list $r $foo
} {barneybarney {{ERROR {Command 'rn2' does not exist} 2}}}

proc varargproc {a b args} {
    return "$a $b $args"
}

test varargs-1 {
    varargproc x
} {{ERROR {proc varargproc doesn't have enough arguments}} {varargproc 2}}

test varargs-2 {
    varargproc x y
} {x y }

test varargs-3 {
    varargproc x y z
} {x y z}

test varargs-4 {
    varargproc x y 1 2 3 4 5 6
} {x y 1 2 3 4 5 6}
<commit_msg>Added test demonstrating problem with recursion.<commit_after>
test proc-1 {
    set a 1
    proc foo {a b} {
	set a [+ $a 1]
	+ $a $b
    }
    set res "$a [foo $a 5]"
    set res
} {1 7}

test proc-2 {
    proc badcommand {a b} {}
    badcommand a b c d
} {{ERROR {proc badcommand has too many arguments}} {badcommand 3}}

test proc-3 {
    proc badcommand {a b} {}
    badcommand a
} {{ERROR {proc badcommand doesn't have enough arguments}} {badcommand 3}}

test proc-4 {
    proc f1 {} {return hello}
    proc f2 {} {return world}
    proc f3 {f} {$f}
    set res ""
    append $res [f3 f1]
    append $res [f3 f2]
    set res
} {helloworld}

test rename-1 {
    proc f1 {} {return fred}
    set r [f1]
    rename f1 newcmd
    append $r [newcmd]
    set r
} {fredfred}

test rename-2 {
    proc rn2 {} {return barney}
    set r [rn2]
    rename rn2 rn2new
    catch {
	append $r [rn2]
    } foo
    append $r [rn2new]
    list $r $foo
} {barneybarney {{ERROR {Command 'rn2' does not exist} 2}}}

proc varargproc {a b args} {
    return "$a $b $args"
}

test varargs-1 {
    varargproc x
} {{ERROR {proc varargproc doesn't have enough arguments}} {varargproc 2}}

test varargs-2 {
    varargproc x y
} {x y }

test varargs-3 {
    varargproc x y z
} {x y z}

test varargs-4 {
    varargproc x y 1 2 3 4 5 6
} {x y 1 2 3 4 5 6}

test recurse-1 {
    proc Recurse {o} {
	if {> $o 1} {
	    set res "<"
	    append $res [Recurse [- $o 1]]
	    append $res ">"
	    return $res
	} else {
	    return $o
	}
    }
    Recurse 5
} {<<<<1>>>>}
{'fraction_non_alphanumeric': 0.12839506172839507, 'fraction_numerical': 0.03562610229276896, 'mean_word_length': 2.297674418604651, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2828872', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1117, 'n_words': 422}