Commit Graph

11 Commits

Author SHA1 Message Date
Zoltan Somogyi
a5f9cb6851 Reduce differences between interpreter.m versions.
extras/trailed_update/samples/interpreter.m:
samples/interpreter.m:
    We have these two different versions of a pure Prolog interpreter
    as examples of Mercury code. Reduce the number of unneeded points
    of difference between them, by copying the better code at each such point
    to the other file.

tests/debugger/interpreter.m:
    This file is automatically copied from samples/interpreter.m.

tests/debugger/interpreter.exp:
    Expect the changes caused by the update to the source file.
2023-06-22 14:54:59 +02:00
Zoltan Somogyi
340e5995d5 Fix spelling. 2022-04-02 20:16:49 +11:00
Zoltan Somogyi
84223268a0 Delete the tests/general/interpreter test case.
tests/general/interpreter.{m,inp,exp}:
tests/general/Mmakefile:
    As above: delete this test case.

samples/interpreter.m:
    Delete reference to the deleted test case.

tests/debugger/interpreter.m:
    Delete reference to the deleted test case in this copy of
    samples/interpreter.m.

tests/debugger/interpreter.exp:
tests/debugger/interpreter.exp2:
    The last update of interpreter.exp was in 2003. The command we invoke
    this test case with has changed several times since then, but none
    of them have been reflected in interpreter.exp, so now there is no way
    for it to be matched. This diff deletes interpreter.exp, and renames
    the old interpreter.exp2 to become the new interpreter.exp.

tests/general/arithmetic.nl:
tests/general/interpreter.nl:
tests/general/string_test.nl:
    Delete these relics of the time when we compared output generated
    by Mercury to output generated by NU-Prolog, since NU-Prolog is long dead.

tests/general/arithmetic.m:
tests/general/string_test.m:
    Update programming style, and factor out common code.
2022-03-04 17:25:20 +11:00
Zoltan Somogyi
92f60e5c70 Standardize on one interpreter.m.
samples/interpreter.m:
    Make this the primary copy of interpreter.m. Incorporate the improvements
    from the other two versions in tests, and generalize them to be suitable
    as a sample program.

tests/debugger/interpreter.m:
tests/general/interpreter.m:
    Make these copies of the primary version.

tests/debugger/Mmakefile:
tests/general/Mmakefile:
    Keep the tests copies of the primary version.

tests/general/interpreter.exp:
    Expect an output now generated for parameter-less invocations.
2022-03-04 14:45:01 +11:00
Zoltan Somogyi
cd4d855390 Delete read_term* predicates from term_io.m.
Their replacements are the corresponding predicates in mercury_term_parser.m,
which they forwarded all their work to anyway.

library/term_io.m:
    As above.

library/mercury_term_parser.m:
    Move the definition of a type needed by the read_term* predicates
    here from term_io.m.

NEWS:
    Document the deletion.

browser/interactive_query.m:
compiler/fact_table.m:
compiler/parse_module.m:
compiler/recompilation.used_file.m:
library/io.m:
    Conform to the change above.

tests/debugger/interpreter.m:
tests/general/interpreter.m:
    Use read_term* from mercury_term_parser, not term_io.

    These two tests started out as versions of the same file once upon a time,
    but have diverged since. Replace them both with a single version that
    works in both test directories, and has updated programming style.

tests/debugger/interpreter.exp2:
tests/debugger/interpreter.inp:
tests/general/interpreter.exp:
    Conform to the changes (renames of some predicates, inlining of others,
    using explicit streams, never complaining about empty argument lists,
    and always printing query results) in interpreter.m.

tests/hard_coded/bug383.m:
tests/hard_coded/term_io_test.m:
    Use read_term* from mercury_term_parser, not term_io.

    In bug383.m, resolve an old type ambiguity to avoid a warning.
2022-03-04 12:58:17 +11:00
Zoltan Somogyi
59b11f84ce Update the debugger test directory.
Replace __ with . as the module qualifier symbol.

Replace references to io.state with just io.

Replace DCGs with state variables.

Replace (C->T;E) syntax for if-then-elses with (if C then T else E) syntax.

Replace if-then-elses with switches when possible and where this does not
affect what is being tested.

Replace separate pred and mode declarations with predmode declarations.

Put predicate and function declarations just before the definition
of the predicate or function.

Delete unneeded module qualifications on predicate and function declarations
and definitions.

Update .exp files (and if needed, .inp files) for the line number changes
that result from the above.

For tests that have more than one .exp file and where one of those files
is affected by the above, add a section to the source file header that says
which .exp file is for what grade, with XXXs for the (as yet) unknown parts.
2018-08-28 21:20:59 +10:00
Zoltan Somogyi
33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11:00
Julien Fischer
012962fd17 Change the argument order of predicates in the varset module to make
Branches: main

Change the argument order of predicates in the varset module to make
them more conducive to the use of state variable notation.

library/varset.m:
	As above.

library/parser.m:
library/term_io.m:
library/svvarset.m:
compiler/*.m:
samples/interpreter.m:
tests/debugger/interpreter.m:
tests/general/interpreter.m:
tests/hard_coded/bigtest.m:
tests/hard_coded/deep_copy_bug.m:
tests/hard_coded/lp.m:
tests/hard_coded/pprint_test.m:
tests/hard_coded/type_spec_ho_term.m:
	Conform to the above change and remove dependencies on the svvarset
	module.
2011-05-05 03:59:00 +00:00
Peter Ross
de9f29c2de Handle the fact that term.variable now
Estimated hours taken: 1
Branches: main

debugger/interpreter.m:
general/interpreter.m:
	Handle the fact that term.variable now
	includes the context.

invalid/record_syntax_errors.err_exp:
	Update due to the improved context
	of constructors.
2006-11-01 06:31:38 +00:00
Zoltan Somogyi
61c7f4ed4e Fix the program for Julien's last change.
Estimated hours taken: 0.1
Branches: main

tests/debugger/interpreter.m:
tests/debugger/retry.m:
	Fix the program for Julien's last change.

tests/debugger/declarative/find_origin.exp:
	Fix the expected output for my last change.
2006-04-07 01:18:48 +00:00
Zoltan Somogyi
67d8308260 Same as previous message. 1998-04-08 11:36:13 +00:00