Move CFC test files into "common" directory
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/82ad2895 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/82ad2895 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/82ad2895 Branch: refs/heads/master Commit: 82ad28953d9d1e2e66fded8ef8ffab85be18f124 Parents: df605b5 Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Sat Mar 5 19:46:12 2016 +0100 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Sat Mar 5 19:52:04 2016 +0100 ---------------------------------------------------------------------- compiler/c/t/cfbase/Animal.cfh | 21 ---- compiler/c/t/cfbase/Animal.cfp | 4 - compiler/c/t/cfbase/Animal/Dog.cfh | 28 ----- compiler/c/t/cfbase/Animal/Util.cfh | 23 ---- compiler/c/t/cfclash/bar/Bar.cfh | 25 ---- compiler/c/t/cfclash/bar/Bar.cfp | 4 - compiler/c/t/cfclash/bar/Baz.cfh | 25 ---- compiler/c/t/cfclash/class/Animal/DogClash.cfh | 28 ----- compiler/c/t/cfclash/class/AnimalExtension.cfp | 5 - compiler/c/t/cfclash/file/Animal/Dog.cfh | 28 ----- compiler/c/t/cfclash/foo/Foo.cfh | 25 ---- compiler/c/t/cfclash/foo/Foo.cfp | 4 - compiler/c/t/cfext/Animal/Rottweiler.cfh | 31 ----- compiler/c/t/cfext/AnimalExtension.cfp | 8 -- compiler/c/t/test_cfc.c | 2 +- compiler/common/test/cfbase/Animal.cfh | 21 ++++ compiler/common/test/cfbase/Animal.cfp | 4 + compiler/common/test/cfbase/Animal/Dog.cfh | 28 +++++ compiler/common/test/cfbase/Animal/Util.cfh | 23 ++++ compiler/common/test/cfclash/bar/Bar.cfh | 25 ++++ compiler/common/test/cfclash/bar/Bar.cfp | 4 + compiler/common/test/cfclash/bar/Baz.cfh | 25 ++++ .../test/cfclash/class/Animal/DogClash.cfh | 28 +++++ .../test/cfclash/class/AnimalExtension.cfp | 5 + .../common/test/cfclash/file/Animal/Dog.cfh | 28 +++++ compiler/common/test/cfclash/foo/Foo.cfh | 25 ++++ compiler/common/test/cfclash/foo/Foo.cfp | 4 + .../common/test/cfext/Animal/Rottweiler.cfh | 31 +++++ compiler/common/test/cfext/AnimalExtension.cfp | 8 ++ compiler/perl/buildlib/Clownfish/CFC/Build.pm | 21 ++-- .../buildlib/Clownfish/CFC/Test/TestUtils.pm | 44 +++++++ compiler/perl/lib/Clownfish/CFC.xs | 5 +- compiler/perl/t/403-parcel.t | 3 +- compiler/perl/t/500-hierarchy.t | 7 +- compiler/perl/t/501-include_dir.t | 7 +- compiler/perl/t/cfbase/Animal.cfh | 21 ---- compiler/perl/t/cfbase/Animal.cfp | 4 - compiler/perl/t/cfbase/Animal/Dog.cfh | 28 ----- compiler/perl/t/cfbase/Animal/Util.cfh | 23 ---- compiler/perl/t/cfext/Animal/Rottweiler.cfh | 31 ----- compiler/perl/t/cfext/AnimalExtension.cfp | 8 -- compiler/perl/t/core/403-parcel.t | 6 +- compiler/perl/t/core/500-hierarchy.t | 6 +- compiler/src/CFCTest.c | 20 ++- compiler/src/CFCTest.h | 9 +- compiler/src/CFCTestHierarchy.c | 121 +++++++++++-------- compiler/src/CFCTestParcel.c | 3 +- 47 files changed, 433 insertions(+), 454 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfbase/Animal.cfh ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfbase/Animal.cfh b/compiler/c/t/cfbase/Animal.cfh deleted file mode 100644 index 46130b7..0000000 --- a/compiler/c/t/cfbase/Animal.cfh +++ /dev/null @@ -1,21 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel Animal; - -class Clownfish::Obj { } - -abstract class Animal { } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfbase/Animal.cfp ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfbase/Animal.cfp b/compiler/c/t/cfbase/Animal.cfp deleted file mode 100644 index e2b5ab5..0000000 --- a/compiler/c/t/cfbase/Animal.cfp +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Animal", - "version": "v0.1.0" -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfbase/Animal/Dog.cfh ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfbase/Animal/Dog.cfh b/compiler/c/t/cfbase/Animal/Dog.cfh deleted file mode 100644 index 6d54baa..0000000 --- a/compiler/c/t/cfbase/Animal/Dog.cfh +++ /dev/null @@ -1,28 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel Animal; - -class Animal::Dog inherits Animal { - public inert incremented Dog* - new(); - - public inert Dog* - init(Dog *self); - - public void - Bark(Dog *self); -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfbase/Animal/Util.cfh ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfbase/Animal/Util.cfh b/compiler/c/t/cfbase/Animal/Util.cfh deleted file mode 100644 index f5688a5..0000000 --- a/compiler/c/t/cfbase/Animal/Util.cfh +++ /dev/null @@ -1,23 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel Animal; - -inert class Animal::Util { - inert void - groom(Animal *animal); -} - http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfclash/bar/Bar.cfh ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfclash/bar/Bar.cfh b/compiler/c/t/cfclash/bar/Bar.cfh deleted file mode 100644 index 89e798e..0000000 --- a/compiler/c/t/cfclash/bar/Bar.cfh +++ /dev/null @@ -1,25 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel Bar; - -public class Bar inherits Clownfish::Obj { - int var; - - public void - Method(Bar *self); -} - http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfclash/bar/Bar.cfp ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfclash/bar/Bar.cfp b/compiler/c/t/cfclash/bar/Bar.cfp deleted file mode 100644 index e5868f6..0000000 --- a/compiler/c/t/cfclash/bar/Bar.cfp +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Bar", - "version": "v1.0.0" -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfclash/bar/Baz.cfh ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfclash/bar/Baz.cfh b/compiler/c/t/cfclash/bar/Baz.cfh deleted file mode 100644 index 00e4033..0000000 --- a/compiler/c/t/cfclash/bar/Baz.cfh +++ /dev/null @@ -1,25 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel Foo; - -public class Baz inherits Clownfish::Obj { - int var; - - public void - Method(Baz *self); -} - http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfclash/class/Animal/DogClash.cfh ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfclash/class/Animal/DogClash.cfh b/compiler/c/t/cfclash/class/Animal/DogClash.cfh deleted file mode 100644 index 3eba020..0000000 --- a/compiler/c/t/cfclash/class/Animal/DogClash.cfh +++ /dev/null @@ -1,28 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel AnimalExtension; - -class Animal::Dog inherits Clownfish::Obj { - public inert incremented Dog* - new(); - - public inert Dog* - init(Dog *self); - - public void - Bark(Dog *self); -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfclash/class/AnimalExtension.cfp ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfclash/class/AnimalExtension.cfp b/compiler/c/t/cfclash/class/AnimalExtension.cfp deleted file mode 100644 index 76f31d3..0000000 --- a/compiler/c/t/cfclash/class/AnimalExtension.cfp +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "AnimalExtension", - "nickname": "AniExt", - "version": "v0.1.0" -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfclash/file/Animal/Dog.cfh ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfclash/file/Animal/Dog.cfh b/compiler/c/t/cfclash/file/Animal/Dog.cfh deleted file mode 100644 index 1357109..0000000 --- a/compiler/c/t/cfclash/file/Animal/Dog.cfh +++ /dev/null @@ -1,28 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel Animal; - -class Animal::AnotherDog inherits Animal { - public inert incremented AnotherDog* - new(); - - public inert AnotherDog* - init(AnotherDog *self); - - public void - Bark(AnotherDog *self); -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfclash/foo/Foo.cfh ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfclash/foo/Foo.cfh b/compiler/c/t/cfclash/foo/Foo.cfh deleted file mode 100644 index b770d8a..0000000 --- a/compiler/c/t/cfclash/foo/Foo.cfh +++ /dev/null @@ -1,25 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel Foo; - -public class Foo inherits Clownfish::Obj { - int var; - - public void - Method(Foo *self); -} - http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfclash/foo/Foo.cfp ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfclash/foo/Foo.cfp b/compiler/c/t/cfclash/foo/Foo.cfp deleted file mode 100644 index 2995169..0000000 --- a/compiler/c/t/cfclash/foo/Foo.cfp +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Foo", - "version": "v1.0.0" -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfext/Animal/Rottweiler.cfh ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfext/Animal/Rottweiler.cfh b/compiler/c/t/cfext/Animal/Rottweiler.cfh deleted file mode 100644 index 9e78b58..0000000 --- a/compiler/c/t/cfext/Animal/Rottweiler.cfh +++ /dev/null @@ -1,31 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel AnimalExtension; - -class Animal::Rottweiler inherits Animal::Dog { - public inert incremented Rottweiler* - new(); - - public inert Rottweiler* - init(Rottweiler *self); - - public void - Bark(Rottweiler *self); - - public void - Bite(Rottweiler *self); -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfext/AnimalExtension.cfp ---------------------------------------------------------------------- diff --git a/compiler/c/t/cfext/AnimalExtension.cfp b/compiler/c/t/cfext/AnimalExtension.cfp deleted file mode 100644 index 8b8e75b..0000000 --- a/compiler/c/t/cfext/AnimalExtension.cfp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "AnimalExtension", - "nickname": "AniExt", - "version": "v0.1.0", - "prerequisites": { - "Animal": null - } -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/test_cfc.c ---------------------------------------------------------------------- diff --git a/compiler/c/t/test_cfc.c b/compiler/c/t/test_cfc.c index 66fa90a..cb55d45 100644 --- a/compiler/c/t/test_cfc.c +++ b/compiler/c/t/test_cfc.c @@ -22,7 +22,7 @@ int main() { CFCTest *test = CFCTest_new("clownfish"); - CFCTest_run_all(test); + CFCTest_run_all(test, NULL); int pass = CFCTest_finish(test); CFCBase_decref((CFCBase*)test); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfbase/Animal.cfh ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfbase/Animal.cfh b/compiler/common/test/cfbase/Animal.cfh new file mode 100644 index 0000000..46130b7 --- /dev/null +++ b/compiler/common/test/cfbase/Animal.cfh @@ -0,0 +1,21 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +parcel Animal; + +class Clownfish::Obj { } + +abstract class Animal { } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfbase/Animal.cfp ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfbase/Animal.cfp b/compiler/common/test/cfbase/Animal.cfp new file mode 100644 index 0000000..e2b5ab5 --- /dev/null +++ b/compiler/common/test/cfbase/Animal.cfp @@ -0,0 +1,4 @@ +{ + "name": "Animal", + "version": "v0.1.0" +} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfbase/Animal/Dog.cfh ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfbase/Animal/Dog.cfh b/compiler/common/test/cfbase/Animal/Dog.cfh new file mode 100644 index 0000000..6d54baa --- /dev/null +++ b/compiler/common/test/cfbase/Animal/Dog.cfh @@ -0,0 +1,28 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +parcel Animal; + +class Animal::Dog inherits Animal { + public inert incremented Dog* + new(); + + public inert Dog* + init(Dog *self); + + public void + Bark(Dog *self); +} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfbase/Animal/Util.cfh ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfbase/Animal/Util.cfh b/compiler/common/test/cfbase/Animal/Util.cfh new file mode 100644 index 0000000..f5688a5 --- /dev/null +++ b/compiler/common/test/cfbase/Animal/Util.cfh @@ -0,0 +1,23 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +parcel Animal; + +inert class Animal::Util { + inert void + groom(Animal *animal); +} + http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfclash/bar/Bar.cfh ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfclash/bar/Bar.cfh b/compiler/common/test/cfclash/bar/Bar.cfh new file mode 100644 index 0000000..89e798e --- /dev/null +++ b/compiler/common/test/cfclash/bar/Bar.cfh @@ -0,0 +1,25 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +parcel Bar; + +public class Bar inherits Clownfish::Obj { + int var; + + public void + Method(Bar *self); +} + http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfclash/bar/Bar.cfp ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfclash/bar/Bar.cfp b/compiler/common/test/cfclash/bar/Bar.cfp new file mode 100644 index 0000000..e5868f6 --- /dev/null +++ b/compiler/common/test/cfclash/bar/Bar.cfp @@ -0,0 +1,4 @@ +{ + "name": "Bar", + "version": "v1.0.0" +} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfclash/bar/Baz.cfh ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfclash/bar/Baz.cfh b/compiler/common/test/cfclash/bar/Baz.cfh new file mode 100644 index 0000000..00e4033 --- /dev/null +++ b/compiler/common/test/cfclash/bar/Baz.cfh @@ -0,0 +1,25 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +parcel Foo; + +public class Baz inherits Clownfish::Obj { + int var; + + public void + Method(Baz *self); +} + http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfclash/class/Animal/DogClash.cfh ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfclash/class/Animal/DogClash.cfh b/compiler/common/test/cfclash/class/Animal/DogClash.cfh new file mode 100644 index 0000000..3eba020 --- /dev/null +++ b/compiler/common/test/cfclash/class/Animal/DogClash.cfh @@ -0,0 +1,28 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +parcel AnimalExtension; + +class Animal::Dog inherits Clownfish::Obj { + public inert incremented Dog* + new(); + + public inert Dog* + init(Dog *self); + + public void + Bark(Dog *self); +} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfclash/class/AnimalExtension.cfp ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfclash/class/AnimalExtension.cfp b/compiler/common/test/cfclash/class/AnimalExtension.cfp new file mode 100644 index 0000000..76f31d3 --- /dev/null +++ b/compiler/common/test/cfclash/class/AnimalExtension.cfp @@ -0,0 +1,5 @@ +{ + "name": "AnimalExtension", + "nickname": "AniExt", + "version": "v0.1.0" +} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfclash/file/Animal/Dog.cfh ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfclash/file/Animal/Dog.cfh b/compiler/common/test/cfclash/file/Animal/Dog.cfh new file mode 100644 index 0000000..1357109 --- /dev/null +++ b/compiler/common/test/cfclash/file/Animal/Dog.cfh @@ -0,0 +1,28 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +parcel Animal; + +class Animal::AnotherDog inherits Animal { + public inert incremented AnotherDog* + new(); + + public inert AnotherDog* + init(AnotherDog *self); + + public void + Bark(AnotherDog *self); +} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfclash/foo/Foo.cfh ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfclash/foo/Foo.cfh b/compiler/common/test/cfclash/foo/Foo.cfh new file mode 100644 index 0000000..b770d8a --- /dev/null +++ b/compiler/common/test/cfclash/foo/Foo.cfh @@ -0,0 +1,25 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +parcel Foo; + +public class Foo inherits Clownfish::Obj { + int var; + + public void + Method(Foo *self); +} + http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfclash/foo/Foo.cfp ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfclash/foo/Foo.cfp b/compiler/common/test/cfclash/foo/Foo.cfp new file mode 100644 index 0000000..2995169 --- /dev/null +++ b/compiler/common/test/cfclash/foo/Foo.cfp @@ -0,0 +1,4 @@ +{ + "name": "Foo", + "version": "v1.0.0" +} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfext/Animal/Rottweiler.cfh ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfext/Animal/Rottweiler.cfh b/compiler/common/test/cfext/Animal/Rottweiler.cfh new file mode 100644 index 0000000..9e78b58 --- /dev/null +++ b/compiler/common/test/cfext/Animal/Rottweiler.cfh @@ -0,0 +1,31 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +parcel AnimalExtension; + +class Animal::Rottweiler inherits Animal::Dog { + public inert incremented Rottweiler* + new(); + + public inert Rottweiler* + init(Rottweiler *self); + + public void + Bark(Rottweiler *self); + + public void + Bite(Rottweiler *self); +} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/common/test/cfext/AnimalExtension.cfp ---------------------------------------------------------------------- diff --git a/compiler/common/test/cfext/AnimalExtension.cfp b/compiler/common/test/cfext/AnimalExtension.cfp new file mode 100644 index 0000000..8b8e75b --- /dev/null +++ b/compiler/common/test/cfext/AnimalExtension.cfp @@ -0,0 +1,8 @@ +{ + "name": "AnimalExtension", + "nickname": "AniExt", + "version": "v0.1.0", + "prerequisites": { + "Animal": null + } +} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/buildlib/Clownfish/CFC/Build.pm ---------------------------------------------------------------------- diff --git a/compiler/perl/buildlib/Clownfish/CFC/Build.pm b/compiler/perl/buildlib/Clownfish/CFC/Build.pm index dd67a0b..0637b71 100644 --- a/compiler/perl/buildlib/Clownfish/CFC/Build.pm +++ b/compiler/perl/buildlib/Clownfish/CFC/Build.pm @@ -265,15 +265,18 @@ sub ACTION_dist { # the top-level $REPOS_ROOT. Because some assets we need are outside this # directory, we need to copy them in. my %to_copy = ( - '../../CONTRIBUTING.md' => 'CONTRIBUTING.md', - '../../LICENSE' => 'LICENSE', - '../../NOTICE' => 'NOTICE', - '../../README.md' => 'README.md', - '../../lemon' => 'lemon', - '../src' => 'src', - '../include' => 'include', - '../modules' => 'modules', - $CHARMONIZER_C => 'charmonizer.c', + '../../CONTRIBUTING.md' => 'CONTRIBUTING.md', + '../../LICENSE' => 'LICENSE', + '../../NOTICE' => 'NOTICE', + '../../README.md' => 'README.md', + '../../lemon' => 'lemon', + '../src' => 'src', + '../include' => 'include', + '../modules' => 'modules', + '../common/test/cfbase' => 't/cfbase', + '../common/test/cfclash' => 't/cfclash', + '../common/test/cfext' => 't/cfext', + $CHARMONIZER_C => 'charmonizer.c', ); print "Copying files...\n"; while (my ($from, $to) = each %to_copy) { http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/buildlib/Clownfish/CFC/Test/TestUtils.pm ---------------------------------------------------------------------- diff --git a/compiler/perl/buildlib/Clownfish/CFC/Test/TestUtils.pm b/compiler/perl/buildlib/Clownfish/CFC/Test/TestUtils.pm new file mode 100644 index 0000000..2df524d --- /dev/null +++ b/compiler/perl/buildlib/Clownfish/CFC/Test/TestUtils.pm @@ -0,0 +1,44 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +use strict; +use warnings; + +package Clownfish::CFC::Test::TestUtils; + +our $VERSION = '0.005000'; +$VERSION = eval $VERSION; + +use Exporter 'import'; +our @EXPORT_OK = qw( test_files_dir ); + +use File::Spec::Functions qw( catdir updir ); + +sub test_files_dir { + my @dirs = ( + 't', + catdir( updir(), 'common', 'test' ), + ); + + for my $dir (@dirs) { + my $cfbase = catdir( $dir, 'cfbase' ); + return $dir if -d $cfbase; + } + + die("test files dir not found"); +} + +1; + http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/lib/Clownfish/CFC.xs ---------------------------------------------------------------------- diff --git a/compiler/perl/lib/Clownfish/CFC.xs b/compiler/perl/lib/Clownfish/CFC.xs index 20f889f..368043c 100644 --- a/compiler/perl/lib/Clownfish/CFC.xs +++ b/compiler/perl/lib/Clownfish/CFC.xs @@ -2484,10 +2484,11 @@ CODE: OUTPUT: RETVAL int -run_batch(self, klass) +run_batch(self, klass, test_files_dir = NULL) CFCTest *self; const char *klass; + const char *test_files_dir; CODE: - RETVAL = CFCTest_run_batch(self, klass); + RETVAL = CFCTest_run_batch(self, klass, test_files_dir); OUTPUT: RETVAL http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/t/403-parcel.t ---------------------------------------------------------------------- diff --git a/compiler/perl/t/403-parcel.t b/compiler/perl/t/403-parcel.t index 263e602..fec23e3 100644 --- a/compiler/perl/t/403-parcel.t +++ b/compiler/perl/t/403-parcel.t @@ -16,6 +16,7 @@ use strict; use warnings; +use Clownfish::CFC::Test::TestUtils qw( test_files_dir ); use Test::More tests => 35; use File::Spec::Functions qw( catfile ); @@ -87,7 +88,7 @@ isa_ok( isa_ok( Clownfish::CFC::Model::Parcel->new_from_file( - path => catfile(qw( t cfbase Animal.cfp )), + path => catfile( test_files_dir(), qw( cfbase Animal.cfp ) ), ), "Clownfish::CFC::Model::Parcel", "new_from_file" http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/t/500-hierarchy.t ---------------------------------------------------------------------- diff --git a/compiler/perl/t/500-hierarchy.t b/compiler/perl/t/500-hierarchy.t index 62ac046..44b0b6a 100644 --- a/compiler/perl/t/500-hierarchy.t +++ b/compiler/perl/t/500-hierarchy.t @@ -20,14 +20,13 @@ use Test::More tests => 21; use Clownfish::CFC::Model::Hierarchy; use Clownfish::CFC::Util qw( a_isa_b ); +use Clownfish::CFC::Test::TestUtils qw( test_files_dir ); use File::Spec::Functions qw( catdir catfile splitpath ); use Fcntl; use File::Path qw( rmtree mkpath ); -my $base_dir = catdir(qw( t cfbase )); -my %args = ( - dest => catdir(qw( t cfdest )), -); +my $base_dir = catdir( test_files_dir(), 'cfbase' ); +my %args = ( dest => 'autogen' ); # Clean up. rmtree( $args{dest} ); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/t/501-include_dir.t ---------------------------------------------------------------------- diff --git a/compiler/perl/t/501-include_dir.t b/compiler/perl/t/501-include_dir.t index 13dccfa..0e4d24e 100644 --- a/compiler/perl/t/501-include_dir.t +++ b/compiler/perl/t/501-include_dir.t @@ -19,12 +19,13 @@ use warnings; use Test::More tests => 24; use Clownfish::CFC::Model::Hierarchy; +use Clownfish::CFC::Test::TestUtils qw( test_files_dir ); use File::Spec::Functions qw( catdir catfile splitpath ); use File::Path qw( rmtree ); -my $base_dir = catdir(qw( t cfbase )); -my $ext_dir = catdir(qw( t cfext )); -my $dest_dir = catdir(qw( t cfdest )); +my $base_dir = catdir( test_files_dir(), 'cfbase' ); +my $ext_dir = catdir( test_files_dir(), 'cfext' ); +my $dest_dir = 'autogen'; # One source, one include http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/t/cfbase/Animal.cfh ---------------------------------------------------------------------- diff --git a/compiler/perl/t/cfbase/Animal.cfh b/compiler/perl/t/cfbase/Animal.cfh deleted file mode 100644 index 46130b7..0000000 --- a/compiler/perl/t/cfbase/Animal.cfh +++ /dev/null @@ -1,21 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel Animal; - -class Clownfish::Obj { } - -abstract class Animal { } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/t/cfbase/Animal.cfp ---------------------------------------------------------------------- diff --git a/compiler/perl/t/cfbase/Animal.cfp b/compiler/perl/t/cfbase/Animal.cfp deleted file mode 100644 index e2b5ab5..0000000 --- a/compiler/perl/t/cfbase/Animal.cfp +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Animal", - "version": "v0.1.0" -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/t/cfbase/Animal/Dog.cfh ---------------------------------------------------------------------- diff --git a/compiler/perl/t/cfbase/Animal/Dog.cfh b/compiler/perl/t/cfbase/Animal/Dog.cfh deleted file mode 100644 index 6d54baa..0000000 --- a/compiler/perl/t/cfbase/Animal/Dog.cfh +++ /dev/null @@ -1,28 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel Animal; - -class Animal::Dog inherits Animal { - public inert incremented Dog* - new(); - - public inert Dog* - init(Dog *self); - - public void - Bark(Dog *self); -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/t/cfbase/Animal/Util.cfh ---------------------------------------------------------------------- diff --git a/compiler/perl/t/cfbase/Animal/Util.cfh b/compiler/perl/t/cfbase/Animal/Util.cfh deleted file mode 100644 index f5688a5..0000000 --- a/compiler/perl/t/cfbase/Animal/Util.cfh +++ /dev/null @@ -1,23 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel Animal; - -inert class Animal::Util { - inert void - groom(Animal *animal); -} - http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/t/cfext/Animal/Rottweiler.cfh ---------------------------------------------------------------------- diff --git a/compiler/perl/t/cfext/Animal/Rottweiler.cfh b/compiler/perl/t/cfext/Animal/Rottweiler.cfh deleted file mode 100644 index 9e78b58..0000000 --- a/compiler/perl/t/cfext/Animal/Rottweiler.cfh +++ /dev/null @@ -1,31 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -parcel AnimalExtension; - -class Animal::Rottweiler inherits Animal::Dog { - public inert incremented Rottweiler* - new(); - - public inert Rottweiler* - init(Rottweiler *self); - - public void - Bark(Rottweiler *self); - - public void - Bite(Rottweiler *self); -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/t/cfext/AnimalExtension.cfp ---------------------------------------------------------------------- diff --git a/compiler/perl/t/cfext/AnimalExtension.cfp b/compiler/perl/t/cfext/AnimalExtension.cfp deleted file mode 100644 index 8b8e75b..0000000 --- a/compiler/perl/t/cfext/AnimalExtension.cfp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "AnimalExtension", - "nickname": "AniExt", - "version": "v0.1.0", - "prerequisites": { - "Animal": null - } -} http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/t/core/403-parcel.t ---------------------------------------------------------------------- diff --git a/compiler/perl/t/core/403-parcel.t b/compiler/perl/t/core/403-parcel.t index 1258f6d..13a176d 100644 --- a/compiler/perl/t/core/403-parcel.t +++ b/compiler/perl/t/core/403-parcel.t @@ -17,9 +17,13 @@ use strict; use warnings; use Clownfish::CFC::Test; +use Clownfish::CFC::Test::TestUtils qw( test_files_dir ); my $test = Clownfish::CFC::Test->new; -my $passed = $test->run_batch('Clownfish::CFC::Model::Parcel'); +my $passed = $test->run_batch( + 'Clownfish::CFC::Model::Parcel', + test_files_dir(), +); exit($passed ? 0 : 1); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/perl/t/core/500-hierarchy.t ---------------------------------------------------------------------- diff --git a/compiler/perl/t/core/500-hierarchy.t b/compiler/perl/t/core/500-hierarchy.t index 5b60568..1121369 100644 --- a/compiler/perl/t/core/500-hierarchy.t +++ b/compiler/perl/t/core/500-hierarchy.t @@ -17,9 +17,13 @@ use strict; use warnings; use Clownfish::CFC::Test; +use Clownfish::CFC::Test::TestUtils qw( test_files_dir ); my $test = Clownfish::CFC::Test->new; -my $passed = $test->run_batch('Clownfish::CFC::Model::Hierarchy'); +my $passed = $test->run_batch( + 'Clownfish::CFC::Model::Hierarchy', + test_files_dir(), +); exit($passed ? 0 : 1); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/src/CFCTest.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCTest.c b/compiler/src/CFCTest.c index 0f61745..a542c32 100644 --- a/compiler/src/CFCTest.c +++ b/compiler/src/CFCTest.c @@ -104,6 +104,8 @@ static const CFCMeta CFCTEST_META = { (CFCBase_destroy_t)CFCTest_destroy }; +static const char *S_test_files_dir; + static const CFCTestFormatter S_formatter_cfish = { S_format_cfish_batch_prologue, S_format_cfish_vtest_result, @@ -176,9 +178,11 @@ CFCTest_destroy(CFCTest *self) { } int -CFCTest_run_all(CFCTest *self) { +CFCTest_run_all(CFCTest *self, const char *test_files_dir) { int failed = 0; + S_test_files_dir = test_files_dir; + for (int i = 0; S_batches[i]; ++i) { if (!S_do_run_batch(self, S_batches[i])) { failed = 1; } } @@ -187,7 +191,10 @@ CFCTest_run_all(CFCTest *self) { } int -CFCTest_run_batch(CFCTest *self, const char *name) { +CFCTest_run_batch(CFCTest *self, const char *name, + const char *test_files_dir) { + S_test_files_dir = test_files_dir; + for (int i = 0; S_batches[i]; ++i) { const CFCTestBatch *batch = S_batches[i]; if (strcmp(batch->name, name) == 0) { @@ -230,6 +237,15 @@ S_do_run_batch(CFCTest *self, const CFCTestBatch *batch) { return !failed; } +char* +CFCTest_path(const char *path) { + const char *dir = S_test_files_dir + ? S_test_files_dir + : ".." CHY_DIR_SEP "common" CHY_DIR_SEP "test"; + + return CFCUtil_sprintf("%s" CHY_DIR_SEP "%s", dir, path); +} + void CFCTest_test_true(CFCTest *self, int cond, const char *fmt, ...) { va_list args; http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/src/CFCTest.h ---------------------------------------------------------------------- diff --git a/compiler/src/CFCTest.h b/compiler/src/CFCTest.h index 41cf73d..fd8bd30 100644 --- a/compiler/src/CFCTest.h +++ b/compiler/src/CFCTest.h @@ -70,7 +70,7 @@ CFCTest_destroy(CFCTest *self); * @return true if all tests were successful. */ int -CFCTest_run_all(CFCTest *self); +CFCTest_run_all(CFCTest *self, const char *test_files_dir); /** Run a test batch by name. * @@ -78,7 +78,12 @@ CFCTest_run_all(CFCTest *self); * @return true if all tests in the batch were successful. */ int -CFCTest_run_batch(CFCTest *self, const char *name); +CFCTest_run_batch(CFCTest *self, const char *name, const char *test_files_dir); + +/** Return the full path for a test file or directory. + */ +char* +CFCTest_path(const char *path); /* Collect result of a test. * http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/src/CFCTestHierarchy.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCTestHierarchy.c b/compiler/src/CFCTestHierarchy.c index 670f872..75c6393 100644 --- a/compiler/src/CFCTestHierarchy.c +++ b/compiler/src/CFCTestHierarchy.c @@ -37,15 +37,9 @@ #include "CFCTest.h" #include "CFCUtil.h" -#define T_CFBASE "t" CHY_DIR_SEP "cfbase" -#define T_CFEXT "t" CHY_DIR_SEP "cfext" -#define T_CFDEST "t" CHY_DIR_SEP "cfdest" -#define T_CFDEST_INCLUDE T_CFDEST CHY_DIR_SEP "include" -#define T_CFDEST_SOURCE T_CFDEST CHY_DIR_SEP "source" -#define T_CFCLASH_CLASS "t" CHY_DIR_SEP "cfclash" CHY_DIR_SEP "class" -#define T_CFCLASH_FILE "t" CHY_DIR_SEP "cfclash" CHY_DIR_SEP "file" -#define T_CFCLASH_FOO "t" CHY_DIR_SEP "cfclash" CHY_DIR_SEP "foo" -#define T_CFCLASH_BAR "t" CHY_DIR_SEP "cfclash" CHY_DIR_SEP "bar" +#define AUTOGEN "autogen" +#define AUTOGEN_INCLUDE AUTOGEN CHY_DIR_SEP "include" +#define AUTOGEN_SOURCE AUTOGEN CHY_DIR_SEP "source" static void S_run_tests(CFCTest *test); @@ -74,16 +68,18 @@ S_run_tests(CFCTest *test) { static void S_run_basic_tests(CFCTest *test) { - CFCHierarchy *hierarchy = CFCHierarchy_new(T_CFDEST); - STR_EQ(test, CFCHierarchy_get_dest(hierarchy), T_CFDEST, "get_dest"); - STR_EQ(test, CFCHierarchy_get_include_dest(hierarchy), T_CFDEST_INCLUDE, + char *cfbase_path = CFCTest_path("cfbase"); + + CFCHierarchy *hierarchy = CFCHierarchy_new(AUTOGEN); + STR_EQ(test, CFCHierarchy_get_dest(hierarchy), AUTOGEN, "get_dest"); + STR_EQ(test, CFCHierarchy_get_include_dest(hierarchy), AUTOGEN_INCLUDE, "get_include_dest"); - STR_EQ(test, CFCHierarchy_get_source_dest(hierarchy), T_CFDEST_SOURCE, + STR_EQ(test, CFCHierarchy_get_source_dest(hierarchy), AUTOGEN_SOURCE, "get_source_dest"); - CFCHierarchy_add_source_dir(hierarchy, T_CFBASE); + CFCHierarchy_add_source_dir(hierarchy, cfbase_path); const char **source_dirs = CFCHierarchy_get_source_dirs(hierarchy); - STR_EQ(test, source_dirs[0], T_CFBASE, "source_dirs[0]"); + STR_EQ(test, source_dirs[0], cfbase_path, "source_dirs[0]"); OK(test, source_dirs[1] == NULL, "source_dirs[1]"); CFCHierarchy_build(hierarchy); @@ -132,11 +128,11 @@ S_run_basic_tests(CFCTest *test) { time_t now = time(NULL); time_t past_time = now - 2; static const char *const h_paths[] = { - T_CFDEST_INCLUDE CHY_DIR_SEP "Animal.h", - T_CFDEST_INCLUDE CHY_DIR_SEP "Animal" CHY_DIR_SEP "Dog.h", - T_CFDEST_INCLUDE CHY_DIR_SEP "Animal" CHY_DIR_SEP "Util.h" + AUTOGEN_INCLUDE CHY_DIR_SEP "Animal.h", + AUTOGEN_INCLUDE CHY_DIR_SEP "Animal" CHY_DIR_SEP "Dog.h", + AUTOGEN_INCLUDE CHY_DIR_SEP "Animal" CHY_DIR_SEP "Util.h" }; - OK(test, CFCUtil_make_path(T_CFDEST_INCLUDE CHY_DIR_SEP "Animal"), + OK(test, CFCUtil_make_path(AUTOGEN_INCLUDE CHY_DIR_SEP "Animal"), "make_path"); for (int i = 0; i < 3; ++i) { const char *h_path = h_paths[i]; @@ -145,7 +141,7 @@ S_run_basic_tests(CFCTest *test) { CFCTest_set_file_times(h_path, past_time); } - char *cfh_path = CFCFile_cfh_path(animal, T_CFBASE); + char *cfh_path = CFCFile_cfh_path(animal, cfbase_path); CFCTest_set_file_times(cfh_path, now); FREEMEM(cfh_path); @@ -160,24 +156,28 @@ S_run_basic_tests(CFCTest *test) { for (int i = 0; i < 3; ++i) { remove(h_paths[i]); } - rmdir(T_CFDEST_INCLUDE CHY_DIR_SEP "Animal"); - rmdir(T_CFDEST_INCLUDE); - rmdir(T_CFDEST_SOURCE); - rmdir(T_CFDEST); + rmdir(AUTOGEN_INCLUDE CHY_DIR_SEP "Animal"); + rmdir(AUTOGEN_INCLUDE); + rmdir(AUTOGEN_SOURCE); + rmdir(AUTOGEN); CFCBase_decref((CFCBase*)hierarchy); + FREEMEM(cfbase_path); CFCClass_clear_registry(); CFCParcel_reap_singletons(); } static void S_run_include_tests(CFCTest *test) { + char *cfbase_path = CFCTest_path("cfbase"); + char *cfext_path = CFCTest_path("cfext"); + { - CFCHierarchy *hierarchy = CFCHierarchy_new(T_CFDEST); - CFCHierarchy_add_source_dir(hierarchy, T_CFEXT); - CFCHierarchy_add_include_dir(hierarchy, T_CFBASE); + CFCHierarchy *hierarchy = CFCHierarchy_new(AUTOGEN); + CFCHierarchy_add_source_dir(hierarchy, cfext_path); + CFCHierarchy_add_include_dir(hierarchy, cfbase_path); const char **include_dirs = CFCHierarchy_get_include_dirs(hierarchy); - STR_EQ(test, include_dirs[0], T_CFBASE, "include_dirs[0]"); + STR_EQ(test, include_dirs[0], cfbase_path, "include_dirs[0]"); OK(test, include_dirs[1] == NULL, "include_dirs[1]"); CFCHierarchy_build(hierarchy); @@ -210,9 +210,9 @@ S_run_include_tests(CFCTest *test) { } { - CFCHierarchy *hierarchy = CFCHierarchy_new(T_CFDEST); - CFCHierarchy_add_source_dir(hierarchy, T_CFBASE); - CFCHierarchy_add_source_dir(hierarchy, T_CFEXT); + CFCHierarchy *hierarchy = CFCHierarchy_new(AUTOGEN); + CFCHierarchy_add_source_dir(hierarchy, cfbase_path); + CFCHierarchy_add_source_dir(hierarchy, cfext_path); CFCHierarchy_build(hierarchy); @@ -239,9 +239,9 @@ S_run_include_tests(CFCTest *test) { } { - CFCHierarchy *hierarchy = CFCHierarchy_new(T_CFDEST); - CFCHierarchy_add_include_dir(hierarchy, T_CFBASE); - CFCHierarchy_add_include_dir(hierarchy, T_CFEXT); + CFCHierarchy *hierarchy = CFCHierarchy_new(AUTOGEN); + CFCHierarchy_add_include_dir(hierarchy, cfbase_path); + CFCHierarchy_add_include_dir(hierarchy, cfext_path); CFCHierarchy_add_prereq(hierarchy, "AnimalExtension"); CFCHierarchy_build(hierarchy); @@ -267,20 +267,29 @@ S_run_include_tests(CFCTest *test) { CFCParcel_reap_singletons(); } - rmdir(T_CFDEST_INCLUDE); - rmdir(T_CFDEST_SOURCE); - rmdir(T_CFDEST); + rmdir(AUTOGEN_INCLUDE); + rmdir(AUTOGEN_SOURCE); + rmdir(AUTOGEN); + + FREEMEM(cfbase_path); + FREEMEM(cfext_path); } static void S_run_clash_tests(CFCTest *test) { + char *cfbase_path = CFCTest_path("cfbase"); + char *cfclash_file_path = CFCTest_path("cfclash" CHY_DIR_SEP "file"); + char *cfclash_class_path = CFCTest_path("cfclash" CHY_DIR_SEP "class"); + char *cfclash_foo_path = CFCTest_path("cfclash" CHY_DIR_SEP "foo"); + char *cfclash_bar_path = CFCTest_path("cfclash" CHY_DIR_SEP "bar"); + if (getenv("LUCY_VALGRIND")) { SKIP(test, 1, "Exceptions leak"); } else { - CFCHierarchy *hierarchy = CFCHierarchy_new(T_CFDEST); - CFCHierarchy_add_source_dir(hierarchy, T_CFBASE); - CFCHierarchy_add_source_dir(hierarchy, T_CFCLASH_FILE); + CFCHierarchy *hierarchy = CFCHierarchy_new(AUTOGEN); + CFCHierarchy_add_source_dir(hierarchy, cfbase_path); + CFCHierarchy_add_source_dir(hierarchy, cfclash_file_path); char *error; CFCUTIL_TRY { @@ -299,9 +308,9 @@ S_run_clash_tests(CFCTest *test) { SKIP(test, 1, "Exceptions leak"); } else { - CFCHierarchy *hierarchy = CFCHierarchy_new(T_CFDEST); - CFCHierarchy_add_source_dir(hierarchy, T_CFCLASH_CLASS); - CFCHierarchy_add_include_dir(hierarchy, T_CFBASE); + CFCHierarchy *hierarchy = CFCHierarchy_new(AUTOGEN); + CFCHierarchy_add_source_dir(hierarchy, cfclash_class_path); + CFCHierarchy_add_include_dir(hierarchy, cfbase_path); char *error; CFCUTIL_TRY { @@ -317,9 +326,9 @@ S_run_clash_tests(CFCTest *test) { } { - CFCHierarchy *hierarchy = CFCHierarchy_new(T_CFDEST); - CFCHierarchy_add_source_dir(hierarchy, T_CFBASE); - CFCHierarchy_add_include_dir(hierarchy, T_CFCLASH_FILE); + CFCHierarchy *hierarchy = CFCHierarchy_new(AUTOGEN); + CFCHierarchy_add_source_dir(hierarchy, cfbase_path); + CFCHierarchy_add_include_dir(hierarchy, cfclash_file_path); CFCHierarchy_build(hierarchy); CFCClass **ordered = CFCHierarchy_ordered_classes(hierarchy); @@ -337,10 +346,10 @@ S_run_clash_tests(CFCTest *test) { SKIP(test, 1, "Exceptions leak"); } else { - CFCHierarchy *hierarchy = CFCHierarchy_new(T_CFDEST); - CFCHierarchy_add_source_dir(hierarchy, T_CFCLASH_BAR); - CFCHierarchy_add_include_dir(hierarchy, T_CFCLASH_FOO); - CFCHierarchy_add_include_dir(hierarchy, T_CFBASE); + CFCHierarchy *hierarchy = CFCHierarchy_new(AUTOGEN); + CFCHierarchy_add_source_dir(hierarchy, cfclash_bar_path); + CFCHierarchy_add_include_dir(hierarchy, cfclash_foo_path); + CFCHierarchy_add_include_dir(hierarchy, cfbase_path); char *error; CFCUTIL_TRY { @@ -355,8 +364,14 @@ S_run_clash_tests(CFCTest *test) { CFCParcel_reap_singletons(); } - rmdir(T_CFDEST_INCLUDE); - rmdir(T_CFDEST_SOURCE); - rmdir(T_CFDEST); + rmdir(AUTOGEN_INCLUDE); + rmdir(AUTOGEN_SOURCE); + rmdir(AUTOGEN); + + FREEMEM(cfbase_path); + FREEMEM(cfclash_file_path); + FREEMEM(cfclash_class_path); + FREEMEM(cfclash_foo_path); + FREEMEM(cfclash_bar_path); } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/src/CFCTestParcel.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCTestParcel.c b/compiler/src/CFCTestParcel.c index 263c60e..c4f9085 100644 --- a/compiler/src/CFCTestParcel.c +++ b/compiler/src/CFCTestParcel.c @@ -167,10 +167,11 @@ S_run_extended_tests(CFCTest *test) { } { - const char *path = "t" CHY_DIR_SEP "cfbase" CHY_DIR_SEP "Animal.cfp"; + char *path = CFCTest_path("cfbase" CHY_DIR_SEP "Animal.cfp"); CFCParcel *parcel = CFCParcel_new_from_file(path, NULL); OK(test, parcel != NULL, "new_from_file"); CFCBase_decref((CFCBase*)parcel); + FREEMEM(path); } {