Commit 97a99e41 authored by Grégory Mantelet's avatar Grégory Mantelet
Browse files

[ADQL] `FeatureSet.unsupportAll()` must un-support all supported features

instead of ONLY those listed in `availableFeatures`.
parent ade12662
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -427,8 +427,8 @@ public class FeatureSet implements Iterable<LanguageFeature> {
	 * @see #getAvailableFeatures()
	 */
	public final void unsupportAll() {
		// unsupport all available features:
		for(LanguageFeature feature : availableFeatures)
		// unsupport all features currently supported:
		for(LanguageFeature feature : this)
			unsupport(feature);

		// also unsupport any UDF:
+10 −4
Original line number Diff line number Diff line
@@ -215,11 +215,17 @@ public class TestFeatureSet {
	public void testUnsupportAll() {
		FeatureSet set = new FeatureSet(true);

		/* here is a custom Language Feature (i.e. not part of the
		 * availableFeatures list): */
		set.support(new LanguageFeature(LanguageFeature.TYPE_UDF, "foo(VARCHAR) -> BOOLEAN", true));

		// unsupport all currently supported features:
		set.unsupportAll();
		for(LanguageFeature feat : FeatureSet.availableFeatures) {
			assertNotNull(feat);
			assertFalse(set.supportedFeatures.containsKey(feat.type));
		}

		// ensure the list of supported features is really empty:
		assertEquals(0, set.supportedFeatures.size());

		// ...and that no non-declared UDF is allowed:
		assertFalse(set.isAnyUdfAllowed());
	}