Commits

Taku Miyakawa  committed e90b73f

Renames a list function: /list.bytes -> .to_bytes

  • Participants
  • Parent commits b02102b
  • Branches issue514-rename-functions-liable-to-be-confused-as-attributes

Comments (0)

Files changed (3)

File src/main/java/org/kink_lang/kink/internal/box/ValueListEnhancer.java

 
 
         @Define
-        public static Value bytes( @Receiver Value listVal ) {
+        public static Value to_bytes( @Receiver Value listVal ) {
             List< Value > list = ( (ValueList) listVal.unbox() ).getElements();
             byte[] bytes = new byte[ list.size() ];
             int index = 0;

File src/test/java/org/kink_lang/kink/internal/box/ValueListEnhancerTest.java

     }
 
 
-    /** GetSite of {@code bytes}. */
-    private static final GetSite BYTES = new GetSite( "bytes" );
+    /** GetSite of {@code to_bytes}. */
+    private static final GetSite TO_BYTES = new GetSite( "to_bytes" );
 
 
     @Test
-    public void bytes_returns_bytes() {
+    public void test_to_bytes_returns_bytes() {
         Value listVal = box(
                 Value.value( 0x00 )
                 , Value.value( 0x10 )
                 , Value.value( 0x20 ) );
-        Value result = listVal.call( BYTES );
+        Value result = listVal.call( TO_BYTES );
         assertThat(
                 result.as( byte[].class , () -> "" )
                 , is( new byte[] { 0x00 , 0x10 , 0x20 } ) );

File src/test/kink/enhancertest/InputStream_test.kn

 }
 
 test {
-    :Stream = bytes_stream([0 1 2 3].bytes)
-    Stream.read_bytes.check([0 1 2 3].bytes)
+    :Stream = bytes_stream([0 1 2 3].to_bytes)
+    Stream.read_bytes.check([0 1 2 3].to_bytes)
 }
 
 test {
-    :Stream = bytes_stream([0 1 2 3 4 5 6 7 8 9].bytes)
-    Stream.read_bytes(4).check([0 1 2 3].bytes)
+    :Stream = bytes_stream([0 1 2 3 4 5 6 7 8 9].to_bytes)
+    Stream.read_bytes(4).check([0 1 2 3].to_bytes)
 }
 
 test {
-    :Stream = bytes_stream([0 1 2 3 4 5 6 7 8 9].bytes)
-    Stream.read_bytes(20).check([0 1 2 3 4 5 6 7 8 9].bytes)
+    :Stream = bytes_stream([0 1 2 3 4 5 6 7 8 9].to_bytes)
+    Stream.read_bytes(20).check([0 1 2 3 4 5 6 7 8 9].to_bytes)
 }
 
 test {