summary refs log tree commit diff stats
path: root/testament/tests
diff options
context:
space:
mode:
Diffstat (limited to 'testament/tests')
-rw-r--r--testament/tests/shouldfail/tccodecheck.nim2
-rw-r--r--testament/tests/shouldfail/tcolumn.nim6
-rw-r--r--testament/tests/shouldfail/terrormsg.nim6
-rw-r--r--testament/tests/shouldfail/texitcode1.nim2
-rw-r--r--testament/tests/shouldfail/tfile.nim4
-rw-r--r--testament/tests/shouldfail/tline.nim6
-rw-r--r--testament/tests/shouldfail/tmaxcodesize.nim2
-rw-r--r--testament/tests/shouldfail/tmsg.nim6
-rw-r--r--testament/tests/shouldfail/tnimout.nim4
-rw-r--r--testament/tests/shouldfail/tnimoutfull.nim14
-rw-r--r--testament/tests/shouldfail/toutput.nim6
-rw-r--r--testament/tests/shouldfail/toutputsub.nim2
-rw-r--r--testament/tests/shouldfail/treject.nim7
-rw-r--r--testament/tests/shouldfail/tsortoutput.nim4
-rw-r--r--testament/tests/shouldfail/tvalgrind.nim17
15 files changed, 60 insertions, 28 deletions
diff --git a/testament/tests/shouldfail/tccodecheck.nim b/testament/tests/shouldfail/tccodecheck.nim
index a8d216a5b..477da1e23 100644
--- a/testament/tests/shouldfail/tccodecheck.nim
+++ b/testament/tests/shouldfail/tccodecheck.nim
@@ -1,5 +1,5 @@
 discard """
-ccodecheck: "baz"
+  ccodecheck: "baz"
 """
 
 proc foo(): void {.exportc: "bar".}=
diff --git a/testament/tests/shouldfail/tcolumn.nim b/testament/tests/shouldfail/tcolumn.nim
index 89482e673..809ddec74 100644
--- a/testament/tests/shouldfail/tcolumn.nim
+++ b/testament/tests/shouldfail/tcolumn.nim
@@ -1,7 +1,7 @@
 discard """
-errormsg: "undeclared identifier: 'undeclared'"
-line: 8
-column: 7
+  errormsg: "undeclared identifier: 'undeclared'"
+  line: 9
+  column: 7
 """
 
 # test should fail because the line directive is wrong
diff --git a/testament/tests/shouldfail/terrormsg.nim b/testament/tests/shouldfail/terrormsg.nim
index dbbdf5021..6c130d107 100644
--- a/testament/tests/shouldfail/terrormsg.nim
+++ b/testament/tests/shouldfail/terrormsg.nim
@@ -1,7 +1,7 @@
 discard """
-errormsg: "wrong error message"
-line: 8
-column: 6
+  errormsg: "wrong error message"
+  line: 9
+  column: 6
 """
 
 # test should fail because the line directive is wrong
diff --git a/testament/tests/shouldfail/texitcode1.nim b/testament/tests/shouldfail/texitcode1.nim
index 1b38b4f2e..605f046db 100644
--- a/testament/tests/shouldfail/texitcode1.nim
+++ b/testament/tests/shouldfail/texitcode1.nim
@@ -1,3 +1,3 @@
 discard """
-exitcode: 1
+  exitcode: 1
 """
diff --git a/testament/tests/shouldfail/tfile.nim b/testament/tests/shouldfail/tfile.nim
index a6c2ad359..b40a4f44f 100644
--- a/testament/tests/shouldfail/tfile.nim
+++ b/testament/tests/shouldfail/tfile.nim
@@ -1,6 +1,6 @@
 discard """
-errmsg: "undeclared identifier: 'undefined'"
-file: "notthisfile.nim"
+  errormsg: "undeclared identifier: 'undefined'"
+  file: "notthisfile.nim"
 """
 
 echo undefined
diff --git a/testament/tests/shouldfail/tline.nim b/testament/tests/shouldfail/tline.nim
index f7a09875c..fe782eb03 100644
--- a/testament/tests/shouldfail/tline.nim
+++ b/testament/tests/shouldfail/tline.nim
@@ -1,7 +1,7 @@
 discard """
-errormsg: "undeclared identifier: 'undeclared'"
-line: 9
-column: 6
+  errormsg: "undeclared identifier: 'undeclared'"
+  line: 10
+  column: 6
 """
 
 # test should fail because the line directive is wrong
diff --git a/testament/tests/shouldfail/tmaxcodesize.nim b/testament/tests/shouldfail/tmaxcodesize.nim
index 9879e4181..92022ee97 100644
--- a/testament/tests/shouldfail/tmaxcodesize.nim
+++ b/testament/tests/shouldfail/tmaxcodesize.nim
@@ -1,5 +1,5 @@
 discard """
-maxcodesize: 1
+  maxcodesize: 1
 """
 
 echo "Hello World"
diff --git a/testament/tests/shouldfail/tmsg.nim b/testament/tests/shouldfail/tmsg.nim
deleted file mode 100644
index 4ad17fa95..000000000
--- a/testament/tests/shouldfail/tmsg.nim
+++ /dev/null
@@ -1,6 +0,0 @@
-discard """
-msg: "Hello World"
-"""
-
-static:
-  echo "something else"
diff --git a/testament/tests/shouldfail/tnimout.nim b/testament/tests/shouldfail/tnimout.nim
index c0e332053..0a65bfb70 100644
--- a/testament/tests/shouldfail/tnimout.nim
+++ b/testament/tests/shouldfail/tnimout.nim
@@ -1,6 +1,6 @@
 discard """
-nimout: "Hello World!"
-action: compile
+  nimout: "Hello World!"
+  action: compile
 """
 
 static:
diff --git a/testament/tests/shouldfail/tnimoutfull.nim b/testament/tests/shouldfail/tnimoutfull.nim
new file mode 100644
index 000000000..4fc93f6d2
--- /dev/null
+++ b/testament/tests/shouldfail/tnimoutfull.nim
@@ -0,0 +1,14 @@
+discard """
+  nimout: '''
+msg1
+msg2
+'''
+  action: compile
+  nimoutFull: true
+"""
+
+# should fail because `msg3` is not in nimout and `nimoutFill: true` was given
+static:
+  echo "msg1"
+  echo "msg2"
+  echo "msg3"
diff --git a/testament/tests/shouldfail/toutput.nim b/testament/tests/shouldfail/toutput.nim
index ac0bc7a46..eaf9e8652 100644
--- a/testament/tests/shouldfail/toutput.nim
+++ b/testament/tests/shouldfail/toutput.nim
@@ -1,7 +1,7 @@
 discard """
-output: '''
-done
-'''
+  output: '''
+  done
+  '''
 """
 
 echo "broken"
diff --git a/testament/tests/shouldfail/toutputsub.nim b/testament/tests/shouldfail/toutputsub.nim
index 7cc51ee8d..47324ecee 100644
--- a/testament/tests/shouldfail/toutputsub.nim
+++ b/testament/tests/shouldfail/toutputsub.nim
@@ -1,5 +1,5 @@
 discard """
-outputsub: "something else"
+  outputsub: "something else"
 """
 
 echo "Hello World!"
diff --git a/testament/tests/shouldfail/treject.nim b/testament/tests/shouldfail/treject.nim
new file mode 100644
index 000000000..1e7258f70
--- /dev/null
+++ b/testament/tests/shouldfail/treject.nim
@@ -0,0 +1,7 @@
+discard """
+  action: "reject"
+"""
+
+# Because we set action="reject", we expect this line not to compile. But the
+# line does compile, therefore the test fails.
+assert true
diff --git a/testament/tests/shouldfail/tsortoutput.nim b/testament/tests/shouldfail/tsortoutput.nim
index 4ce9ce26d..69dfbc0a0 100644
--- a/testament/tests/shouldfail/tsortoutput.nim
+++ b/testament/tests/shouldfail/tsortoutput.nim
@@ -1,6 +1,6 @@
 discard """
-sortoutput: true
-output: '''
+  sortoutput: true
+  output: '''
 2
 1
 '''
diff --git a/testament/tests/shouldfail/tvalgrind.nim b/testament/tests/shouldfail/tvalgrind.nim
new file mode 100644
index 000000000..d551ff12e
--- /dev/null
+++ b/testament/tests/shouldfail/tvalgrind.nim
@@ -0,0 +1,17 @@
+discard """
+  valgrind: true
+  cmd: "nim $target --gc:arc -d:useMalloc $options $file"
+"""
+
+# this is the same check used by testament/specs.nim whether or not valgrind
+# tests are supported
+when defined(linux) and sizeof(int) == 8:
+  # discarding this allocation will cause valgrind to fail (which is what we
+  # want), but valgrind only runs on 64-bit Linux machines...
+  discard alloc(1)
+else:
+  # ...so on all other OS/architectures, simulate any non-zero exit code to
+  # mimic how valgrind would have failed on this test. We cannot use things like
+  # `disabled: "freebsd"` in the Testament configs above or else the tests will
+  # be SKIP-ed rather than FAIL-ed
+  quit(1) # choose 1 to match valgrind's `--error-exit=1`, but could be anything
60 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931