diff options
author | Marius Kintel <marius@kintel.net> | 2012-01-14 02:25:09 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2012-01-14 02:25:09 (GMT) |
commit | 10701f71581bd4053ab328254d6abacd6956b498 (patch) | |
tree | 235e93f614c1d2d15d9e6b445a632af5d2f3d2c4 /testdata/scad/misc | |
parent | 26c9514b70cee4d49ea5441c50dabbda2631e9fa (diff) |
Added absolute path tests to include and use tests, fixed bug using absolute paths in use and include
Diffstat (limited to 'testdata/scad/misc')
-rw-r--r-- | testdata/scad/misc/include test6.scad | 7 | ||||
-rw-r--r-- | testdata/scad/misc/include-test5.scad | 4 | ||||
-rw-r--r-- | testdata/scad/misc/include-tests-template.scad | 41 | ||||
-rw-r--r-- | testdata/scad/misc/sub1/sub2/sub3/include-test4.scad | 4 | ||||
-rw-r--r-- | testdata/scad/misc/sub1/sub2/sub3/sub4/include-test2.scad | 12 | ||||
-rw-r--r-- | testdata/scad/misc/sub1/sub2/sub3/sub4/include-test3.scad | 4 | ||||
-rw-r--r-- | testdata/scad/misc/sub1/sub2/sub3/sub4/use-test2.scad | 14 | ||||
-rw-r--r-- | testdata/scad/misc/sub1/sub2/sub3/sub4/use-test3.scad | 4 | ||||
-rw-r--r-- | testdata/scad/misc/sub1/sub2/sub3/use-test4.scad | 4 | ||||
-rw-r--r-- | testdata/scad/misc/sub2/test7.scad | 4 | ||||
-rw-r--r-- | testdata/scad/misc/use test6.scad | 7 | ||||
-rw-r--r-- | testdata/scad/misc/use-test5.scad | 4 | ||||
-rw-r--r-- | testdata/scad/misc/use-tests-template.scad | 43 |
13 files changed, 152 insertions, 0 deletions
diff --git a/testdata/scad/misc/include test6.scad b/testdata/scad/misc/include test6.scad new file mode 100644 index 0000000..0d96b26 --- /dev/null +++ b/testdata/scad/misc/include test6.scad @@ -0,0 +1,7 @@ +module test6() +{ + difference() { + cube(center=true); + cylinder(r=0.4, h=2, center=true); + } +} diff --git a/testdata/scad/misc/include-test5.scad b/testdata/scad/misc/include-test5.scad new file mode 100644 index 0000000..e4393cb --- /dev/null +++ b/testdata/scad/misc/include-test5.scad @@ -0,0 +1,4 @@ +module test5() +{ + sphere(r=0.5, $fn=8); +} diff --git a/testdata/scad/misc/include-tests-template.scad b/testdata/scad/misc/include-tests-template.scad new file mode 100644 index 0000000..6724a6d --- /dev/null +++ b/testdata/scad/misc/include-tests-template.scad @@ -0,0 +1,41 @@ +//Test that the entire path is pushed onto the stack upto the last '/' +include <sub1/sub2/sub3/sub4/include-test2.scad> + +//Test that a non existent path/file doesn't screw things up +include <non/existent/path/non-file> + +//Test with empty path +include <include-test5.scad> + +//Test without preceding space +include<include-test5.scad> + +//Test with other strange character that is allowed +include>>>>><include-test5.scad> + +//Test that filenames with spaces work +include <include test6.scad> + +//Test with empty file +include<test/> + +//Test with empty path and file +include </> + +//Test with absolute path +include <@CMAKE_SOURCE_DIR@/../testdata/scad/misc/sub2/test7.scad> + +module test1() +{ + test2(); + translate([2,0,0]) test3(); + translate([2,-2,0]) test4(); + translate([-2,0,0]) test5(); + translate([-2,-2,0]) test6(); + translate([0,2,0]) test7(); + + //Just to give a top level object + translate([0,-2,0]) sphere(test2_variable, $fn=16); +} + +test1(); diff --git a/testdata/scad/misc/sub1/sub2/sub3/include-test4.scad b/testdata/scad/misc/sub1/sub2/sub3/include-test4.scad new file mode 100644 index 0000000..c13368c --- /dev/null +++ b/testdata/scad/misc/sub1/sub2/sub3/include-test4.scad @@ -0,0 +1,4 @@ +module test4() +{ + cylinder(r=0.5, $fn=10, center=true); +} diff --git a/testdata/scad/misc/sub1/sub2/sub3/sub4/include-test2.scad b/testdata/scad/misc/sub1/sub2/sub3/sub4/include-test2.scad new file mode 100644 index 0000000..c34632c --- /dev/null +++ b/testdata/scad/misc/sub1/sub2/sub3/sub4/include-test2.scad @@ -0,0 +1,12 @@ +//Test nested include +include <include-test3.scad> + +//Test relative file location +include <../include-test4.scad> + +test2_variable = 0.7; + +module test2() +{ + cube(center=true); +} diff --git a/testdata/scad/misc/sub1/sub2/sub3/sub4/include-test3.scad b/testdata/scad/misc/sub1/sub2/sub3/sub4/include-test3.scad new file mode 100644 index 0000000..6e3537e --- /dev/null +++ b/testdata/scad/misc/sub1/sub2/sub3/sub4/include-test3.scad @@ -0,0 +1,4 @@ +module test3() +{ + cylinder(r1=0.7, r2=0.2, center=true); +} diff --git a/testdata/scad/misc/sub1/sub2/sub3/sub4/use-test2.scad b/testdata/scad/misc/sub1/sub2/sub3/sub4/use-test2.scad new file mode 100644 index 0000000..68013db --- /dev/null +++ b/testdata/scad/misc/sub1/sub2/sub3/sub4/use-test2.scad @@ -0,0 +1,14 @@ +//Test nested use +use <use-test3.scad> + +//Test relative file location +use <../use-test4.scad> + +test2_variable = 0.7; + +module test2() +{ + translate([2,0,0]) test3(); + translate([2,-2,0]) test4(); + cube(center=true); +} diff --git a/testdata/scad/misc/sub1/sub2/sub3/sub4/use-test3.scad b/testdata/scad/misc/sub1/sub2/sub3/sub4/use-test3.scad new file mode 100644 index 0000000..6e3537e --- /dev/null +++ b/testdata/scad/misc/sub1/sub2/sub3/sub4/use-test3.scad @@ -0,0 +1,4 @@ +module test3() +{ + cylinder(r1=0.7, r2=0.2, center=true); +} diff --git a/testdata/scad/misc/sub1/sub2/sub3/use-test4.scad b/testdata/scad/misc/sub1/sub2/sub3/use-test4.scad new file mode 100644 index 0000000..c13368c --- /dev/null +++ b/testdata/scad/misc/sub1/sub2/sub3/use-test4.scad @@ -0,0 +1,4 @@ +module test4() +{ + cylinder(r=0.5, $fn=10, center=true); +} diff --git a/testdata/scad/misc/sub2/test7.scad b/testdata/scad/misc/sub2/test7.scad new file mode 100644 index 0000000..12ff245 --- /dev/null +++ b/testdata/scad/misc/sub2/test7.scad @@ -0,0 +1,4 @@ +module test7() +{ + cube([0.5,0.5,1], center=true); +} diff --git a/testdata/scad/misc/use test6.scad b/testdata/scad/misc/use test6.scad new file mode 100644 index 0000000..0d96b26 --- /dev/null +++ b/testdata/scad/misc/use test6.scad @@ -0,0 +1,7 @@ +module test6() +{ + difference() { + cube(center=true); + cylinder(r=0.4, h=2, center=true); + } +} diff --git a/testdata/scad/misc/use-test5.scad b/testdata/scad/misc/use-test5.scad new file mode 100644 index 0000000..e4393cb --- /dev/null +++ b/testdata/scad/misc/use-test5.scad @@ -0,0 +1,4 @@ +module test5() +{ + sphere(r=0.5, $fn=8); +} diff --git a/testdata/scad/misc/use-tests-template.scad b/testdata/scad/misc/use-tests-template.scad new file mode 100644 index 0000000..c39efce --- /dev/null +++ b/testdata/scad/misc/use-tests-template.scad @@ -0,0 +1,43 @@ +//Test that the entire path is pushed onto the stack upto the last '/' +use <sub1/sub2/sub3/sub4/use-test2.scad> + +//Test that a non existent path/file doesn't screw things up +use <non/existent/path/non-file> + +//Test with empty path +use <use-test5.scad> + +//Test without preceding space +use<use-test5.scad> + +//Test with other strange character that is allowed +use>>>>><use-test5.scad> + +//Test that filenames with spaces work +use <use test6.scad> + +//Test with empty file +use<test/> + +//Test with empty path and file +use </> + +//Test with absolute path +include <@CMAKE_SOURCE_DIR@/../testdata/scad/misc/sub2/test7.scad> + +module test1() +{ + test2(); + // test3() and test4() are not directly included and thus not imported into + // this scope + translate([4,0,0]) test3(); + translate([4,-2,0]) test4(); + translate([-2,0,0]) test5(); + translate([-2,-2,0]) test6(); + translate([0,2,0]) test7(); + + // test2_variable won't be visible + translate([0,-2,0]) sphere(test2_variable, $fn=16); +} + +test1(); |