Index: tests/phpunit/tests/comment/query.php
===================================================================
--- tests/phpunit/tests/comment/query.php	(revision 41328)
+++ tests/phpunit/tests/comment/query.php	(working copy)
@@ -3025,4 +3025,27 @@
 
 		$this->assertEquals( $number_of_queries, $wpdb->num_queries );
 	}
+
+	/**
+	 * @ticket 39120
+	 */
+	function test_get_and_set() {
+
+                $comments = new WP_Comment_Query;
+
+                $this->assertNull( $comments->get( 'fields' ) );
+                $this->assertNull( $comments->query_vars['fields'] );
+
+                $comments->set( 'fields', 'ids' );
+                $this->assertSame( 'ids', $comments->get( 'fields' ) );
+                $this->assertSame( 'ids', $comments->query_vars['fields'] );
+
+                $comments->set( 'fields', '' );
+                $this->assertSame( '', $comments->get( 'fields' ) );
+                $this->assertSame( '', $comments->query_vars['fields'] );
+
+                $this->assertNull( $comments->get( 'does-not-exist' ) );
+                $this->assertSame( 'foo', $comments->get( 'does-not-exist', 'foo' ) );
+        }
+
 }
